From: Junio C Hamano <gitster@pobox.com>
To: Nils Fahldieck <nils@fahldieck.de>
Cc: git@vger.kernel.org
Subject: Re: [BUG] git config --global: doc and behaviour disagree when ~/.gitconfig and XDG config file coexist
Date: Thu, 30 Jul 2026 13:24:47 -0700 [thread overview]
Message-ID: <xmqqo6fojkds.fsf@gitster.g> (raw)
In-Reply-To: <CAAdFe9yhBk-WecVzCTsjQ-4Z3AZAbpP+w+B076ouM3qX6d1WAg@mail.gmail.com> (Nils Fahldieck's message of "Thu, 30 Jul 2026 20:18:43 +0200")
Nils Fahldieck <nils@fahldieck.de> writes:
> 1. The writing claim is inaccurate.
>
> The docs say XDG is used when ~/.gitconfig "doesn't exist". The
> code tests READABILITY (R_OK), not existence. A zero-byte file
> created by "touch ~/.gitconfig" is readable, so access_or_warn
> returns 0 (success), the condition is false, and XDG is silently
> ignored even though ~/.gitconfig is empty.
>
> The condition should be described as "when ~/.gitconfig is not
> readable", not "when it doesn't exist".
I do not understand this part. If you have a file that is not even
readable by you, it is not very useful and no better than the case
the file did not exist. Also, if the file exists and readable,
between a 0-byte and one liner ~/.gitconfig there shouldn't be any
difference in behaviour, no?
So, "when the file does not exist or even if the file exists is not
readble, then it is not used and the other file is used instead"
would probably be technically more correct, but I am not sure if
such a change has much value (unless you are trying to be very
pedantic).
> 2. The reading claim is outright wrong.
>
> The docs say --global reads from BOTH files. The code reads from
> ONE. git_global_config() selects a winner and frees the other
> path. There is no code path under --global that reads both files.
The documentation needs to be corrected, I think.
next prev parent reply other threads:[~2026-07-30 20:24 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-30 18:18 [BUG] git config --global: doc and behaviour disagree when ~/.gitconfig and XDG config file coexist Nils Fahldieck
2026-07-30 20:24 ` Junio C Hamano [this message]
2026-07-31 0:14 ` Ben Knoble
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqo6fojkds.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=nils@fahldieck.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.