Re: [PATCHv7 1/4] Read (but not write) from $XDG_CONFIG_HOME/git/config file
- From
Ramsay Jones <ramsay@ramsay1.demon.co.uk>
- Date
- Jun 14, 2012, 17:31 UTC
- 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:
Show 22 quoted lines
> 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 <Huynh-Khoi-Nguyen.Nguyen@ensimag.imag.fr> > Signed-off-by: Valentin Duperray <Valentin.Duperray@ensimag.imag.fr> > Signed-off-by: Franck Jonas <Franck.Jonas@ensimag.imag.fr> > Signed-off-by: Lucien Kong <Lucien.Kong@ensimag.imag.fr> > Signed-off-by: Thomas Nguy <Thomas.Nguy@ensimag.imag.fr> > Signed-off-by: Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> > --- > 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
[...]
Show 23 quoted lines
> 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