Re: Git Conditional Includes Question (possible bug?)
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jan 29, 2021, 22:54 UTC
- Message-ID
- <xmqqlfcbs69z.fsf@gitster.c.googlers.com>
- In-Reply-To
- <1E4AB5E8-DD46-45CA-9A3F-C49F115BE0D4@coltonhurst.com>
Colton Hurst <colton@coltonhurst.com> writes:
Show 7 quoted lines
> [Expectation] When I run `cd ~/colton/github/coltonhurst.com` > (this is a valid git repo) and then run `git config user.email`, I > expect ‘colton@coltonhurst.com’ will be returned. > > [Actual Result] When I run `cd ~/colton/github/coltonhurst.com` > (this is a valid git repo) and then run `git config user.email`, > nothing is returned.
The relevant part of the per-user config are
> [user] > name = Colton Hurst
This is not conditional, and applies when you are in the repository.
> [includeIf "gitdir:~/colton/github"] > path = ~/colton/github/.gitconfig
This is conditional, and applies when you are in a repository whose ".git" location matches the glob pattern "~/colton/github". The location in question is "~/colton/github/coltonhurst.com", which does not match the pattern, so it would be skipped.
> [includeIf "gitdir:~/colton/sourcehut"] > path = ~/colton/sourcehut/.gitconfig
Likewise.
So, nobody sets user.email in your example. Isn't it expected that nothing is returned?
I wonder what happens when the second one is updated to
> [includeIf "gitdir:~/colton/github/"] > path = ~/colton/github/.gitconfig
as "git config --help" says:
* If the pattern ends with `/`, `**` will be automatically added. For example, the pattern `foo/` becomes `foo/**`. In other words, it matches "foo" and everything inside, recursively.
and "~/colton/github/**" as a pattern would match the path to the repository in question.