From: Ramsay Jones Date: Thu, 14 Jun 2012 17:31:54 GMT Subject: Re: [PATCHv7 1/4] Read (but not write) from $XDG_CONFIG_HOME/git/config file Message-ID: <4FDA200A.8080200@ramsay1.demon.co.uk> In-Reply-To: <1339469396-29677-1-git-send-email-Huynh-Khoi-Nguyen.Nguyen@ensimag.imag.fr> Huynh Khoi Nguyen Nguyen wrote: > Git will be able to read from $XDG_CONFIG_HOME/git/config, a new > configuration file following XDG specification. In the order of > reading, this file is between global configuration file and system > wide configuration file. Git currently does not write to this new > configuration file. If $XDG_CONFIG_HOME is either not set or empty, > $HOME/.config/git/config will be used. > > Signed-off-by: Huynh Khoi Nguyen Nguyen > Signed-off-by: Valentin Duperray > Signed-off-by: Franck Jonas > Signed-off-by: Lucien Kong > Signed-off-by: Thomas Nguy > Signed-off-by: Matthieu Moy > --- > Documentation/git-config.txt | 12 +++++-- > builtin/config.c | 28 +++++++++++----- > cache.h | 3 ++ > config.c | 23 ++++++++----- > path.c | 41 ++++++++++++++++++++++++ > t/t1306-xdg-files.sh | 70 ++++++++++++++++++++++++++++++++++++++++++ > 6 files changed, 156 insertions(+), 21 deletions(-) > create mode 100755 t/t1306-xdg-files.sh [...] > diff --git a/path.c b/path.c > index 6f2aa69..66acd24 100644 > --- a/path.c > +++ b/path.c > @@ -87,6 +87,21 @@ char *git_pathdup(const char *fmt, ...) > return xstrdup(path); > } > > +char *mkpathdup(const char *fmt, ...) > +{ > + char *path; > + struct strbuf sb = STRBUF_INIT; > + va_list args; > + > + va_start(args, fmt); > + strbuf_vaddf(&sb, fmt, args); > + va_end(args); > + path = xstrdup(cleanup_path(sb.buf)); > + > + strbuf_release(&sb); > + return path; > +} > + As expected, this version avoids re-introducing the bug on Cygwin. I tested the series on Cygwin, MinGW and Linux and it passes it's own tests (t1306-xdg-files.sh) on all platforms. (Well, on MinGW I had to run it thus: $ GIT_TEST_CMP='diff -ub' ./t1306-xdg-files.sh otherwise the first two tests fail because of CRLF vs LF issues). Thanks! ATB, Ramsay Jones