Re: [RFC PATCH 2/3] home_config_path: allow NULL xdg parameter
Junio C Hamano writes: > Matthieu Moy writes: > >> This allows a caller to requst the global config file without requesting >> the XDG one. >> >> Signed-off-by: Matthieu Moy >> --- >> This is actually not needed, but I wrote this for a previous version, >> and it seems sensible anyway. > > I was about to say "Let's not do this until some caller needs it", > implicitly assuming that we do not let global=NULL to signal that > the caller is interested only in XDG, but I checked and we do check > the NULL-ness of global, so it is consistent to do so for xdg. The > change makes very good sense. > > I wouldn't have had to spend the time to dig, if the log message > justified it that way, instead of having "actually not needed" > comment there ;-) > > home_config_paths(): let the caller ignore xdg path > > The caller can signal that it is not interested in learning > the location of $HOME/.gitconfig by passing global=NULL, but > there is no way to decline the ptah to the configuration > file based on $XDG_CONFIG_HOME. > > Allow the caller to pass xdg=NULL to signal that it is not > interested in the XDG location. Good point. Applied locally, I'll resend later. -- Matthieu Moy http://www-verimag.imag.fr/~moy/ -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC PATCH 2/3] home_config_path: allow NULL xdg parameter
Matthieu Moy writes: > This allows a caller to requst the global config file without requesting > the XDG one. > > Signed-off-by: Matthieu Moy > --- > This is actually not needed, but I wrote this for a previous version, > and it seems sensible anyway. I was about to say "Let's not do this until some caller needs it", implicitly assuming that we do not let global=NULL to signal that the caller is interested only in XDG, but I checked and we do check the NULL-ness of global, so it is consistent to do so for xdg. The change makes very good sense. I wouldn't have had to spend the time to dig, if the log message justified it that way, instead of having "actually not needed" comment there ;-) home_config_paths(): let the caller ignore xdg path The caller can signal that it is not interested in learning the location of $HOME/.gitconfig by passing global=NULL, but there is no way to decline the ptah to the configuration file based on $XDG_CONFIG_HOME. Allow the caller to pass xdg=NULL to signal that it is not interested in the XDG location. or something, perhaps? > > path.c | 10 ++ > 1 file changed, 6 insertions(+), 4 deletions(-) > > diff --git a/path.c b/path.c > index 3afcdb4..f68df0c 100644 > --- a/path.c > +++ b/path.c > @@ -148,10 +148,12 @@ void home_config_paths(char **global, char **xdg, char > *file) > *global = mkpathdup("%s/.gitconfig", home); > } > > - if (!xdg_home) > - *xdg = NULL; > - else > - *xdg = mkpathdup("%s/git/%s", xdg_home, file); > + if (xdg) { > + if (!xdg_home) > + *xdg = NULL; > + else > + *xdg = mkpathdup("%s/git/%s", xdg_home, file); > + } > > free(to_free); > } -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC PATCH 2/3] home_config_path: allow NULL xdg parameter
On 7/25/2014 7:14 PM, Matthieu Moy wrote: > This allows a caller to requst the global config file without requesting nit s/requst/request/ -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html