Subject: Re: [PATCHv7 1/4] Read (but not write) from $XDG_CONFIG_HOME/git/config file

From: Ramsay Jones <[email-masked]>
Date: Thu, 14 Jun 2012 18:31:54 +0100

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 <[email-masked]>
> Signed-off-by: Valentin Duperray <[email-masked]>
> Signed-off-by: Franck Jonas <[email-masked]>
> Signed-off-by: Lucien Kong <[email-masked]>
> Signed-off-by: Thomas Nguy <[email-masked]>
> Signed-off-by: Matthieu Moy <[email-masked]>
> ---
>  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