git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2 2/3] home_config_path: allow NULL xdg parameter

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 25, 2014, 19:09 UTC
Message-ID
<xmqqwqb15k7h.fsf@gitster.dls.corp.google.com>
In-Reply-To
<1406311207-8276-2-git-send-email-Matthieu.Moy@imag.fr>
Matthieu Moy <Matthieu.Moy@imag.fr> writes:
Show 5 quoted lines
> This allows a caller to request the global config file without requesting
> the XDG one.
>
> Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
> ---
Will rephrase
    A caller can ask only for XDG location by passing global=NULL.
    Allow it to ask only for the $HOME/.gitconfig by passing
    xdg=NULL.
as you seem to have forgotten ;-)
Show 24 quoted lines
>  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);
>  }
Previous: Matthieu MoyNext: Matthieu Moy
Message 3 of 10 in “config --global --edit: create a template file if needed”
  1. 1/3 config --global --edit: create a template file if neededMatthieu Moy, Jul 25, 2014
  2. 2/3 home_config_path: allow NULL xdg parameterMatthieu Moy, Jul 25, 2014
  3. Junio C HamanoJul 25, 2014
  4. 3/3 commit: advertise config --global --edit on guessed identityMatthieu Moy, Jul 25, 2014
  5. Junio C HamanoJul 25, 2014
  6. 1/3 config --global --edit: create a template file if neededMatthieu Moy, Jul 25, 2014
  7. 2/3 home_config_paths(): let the caller ignore xdg pathMatthieu Moy, Jul 25, 2014
  8. 3/3 commit: advertise config --global --edit on guessed identityMatthieu Moy, Jul 25, 2014
  9. Junio C HamanoJul 25, 2014
  10. Junio C HamanoJul 25, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.