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

Re: [PATCH] doc: clarify usage of XDG_CONFIG_HOME config file

From
Jacob Keller <jacob.keller@gmail.com>
Date
Dec 13, 2017, 05:38 UTC
Message-ID
<CA+P7+xqR0C_Z5fJFdSBvzqCT=LU-mK0cdtaqJ=6TH5Ty60PQrg@mail.gmail.com>
In-Reply-To
<xmqqo9n320ep.fsf@gitster.mtv.corp.google.com>
On Tue, Dec 12, 2017 at 11:47 AM, Junio C Hamano <gitster@pobox.com> wrote:
Show 30 quoted lines
> Jacob Keller <jacob.keller@gmail.com> writes:
>
>>  --global::
>> +     For writing options: write to global user configuration file
>> +     rather than the repository `.git/config`.
>>  +
>> +For reading options: read only from global user configuration file
>> +rather than from all available files.
>>  +
>>  See also <<FILES>>.
>
> OK.
>
>> @@ -237,26 +235,30 @@ See also <<FILES>>.
>>  FILES
>>  -----
>>
>> +If not set explicitly with `--file`, there are three locations where
>>  'git config' will search for configuration options:
>>
>> +System-wide configuration::
>> +     Located at `$(prefix)/etc/gitconfig`.
>>
>> +User-specific configuration::
>> +     One and only one of the following files will be read
>
> We said "will search for" upfront, but this talks about "will be
> read", leaving the reader puzzled as to what should happen when
> writing.  Perhaps "s/read/used/"?
>

Ok, that makes sense. I'm definitely iffy on all this wording, as I didn't really like the previous approach, but couldn't find anything better than the approach shown here.

I'd be welcome to suggestions for another way to format this information.
Show 17 quoted lines
>> ++
>> +- `~/.gitconfig`
>> +- `$XDG_CONFIG_HOME/git/config`
>> +- `$HOME/.config/git/config`
>> ++
>> +If `~/.gitconfig` exists, it will be used, and the other files will not be
>> +read. Otherwise, if `$XDG_CONFIG_HOME` is set, then `$XDG_CONFIG_HOME/git/config`
>> +will be used, otherwise `$HOME/.config/git/config` will be used.
>
> And then "and the other files will not be read" can be dropped from
> the first sentence of this paragraph?
>
> Yaroslav on the original thread mentioned that reading codepath
> without --file or --global does not limit to one of the three, and
> this section is about "If not set explicitly with `--file`", so we'd
> need to make sure if the above is what happens in reality (or update
> the proposed clarification to match the reality).

I'm pretty sure it does not read XDG_CONFIG_HOME unless ~/.gitconfig is missing. I tried a few things, but it was 2am for me, so I may be mis-remembering.

Either way, I'd prefer if we had explicit tests in the suite which verified our assumptions.

Thanks, Jake

>
> Thanks.
Previous: Junio C HamanoNext: Yaroslav Halchenko
Message 5 of 7 in “doc: clarify usage of XDG_CONFIG_HOME config file”
  1. doc: clarify usage of XDG_CONFIG_HOME config fileJacob Keller, Dec 12, 2017
  2. Todd ZullingerDec 12, 2017
  3. Jacob KellerDec 13, 2017
  4. Junio C HamanoDec 12, 2017
  5. Jacob KellerDec 13, 2017
  6. Yaroslav HalchenkoDec 13, 2017
  7. Junio C HamanoDec 13, 2017

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.