Git development
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Matthias Beyer <mail@beyermatthias.de>
Cc: git@vger.kernel.org
Subject: Re: Bug with git-config includeIf
Date: Tue, 11 Apr 2023 09:58:08 -0700	[thread overview]
Message-ID: <xmqqr0sq9x0f.fsf@gitster.g> (raw)
In-Reply-To: <3352350.44csPzL39Z@takeshi> (Matthias Beyer's message of "Tue, 11 Apr 2023 18:05:18 +0200")

Matthias Beyer <mail@beyermatthias.de> writes:

> [includeIf "gitdir:~/dev/work/"]
>     path = ~/config/git/gitconfig_work   
> ```
>
> That means, from my understanding, that all git repositories in ~/dev/work 
> should now have the work-related email address set.
>
> If I go to ~/dev/work/somerepo and `git config --get user.email` it indeed 
> shows the expected email address.

The pattern given to "gitdir:" ends with "/" and implicitly "**" is
added after it.  If "~/dev/work/somerepo" is a repository, going
there and "git rev-parse --git-dir" would say ".git" or
"~/dev/work/somerepo/.git", then the includeIf should trigger.

> But if I go to a subdirectory in that repository, the very same command shows 
> the private email address, and commits get written with that private email 
> address.

I use exactly the same configuration (not for working on this
project, though), and your symptom does not reproduce for me, which
puzzles me.  I go to an equivelent of your ~/dev/work/somerepo/subdir
and "git rev-parse --git-dir" would still report an equivalent of
your "~/dev/work/somerepo/.git", and my "git config --show-origin user.name"
does point at the value of "includeIf.gitdir:~/dev/work/.path".

I wonder what the difference of the set-up is.  

My ~/dev/work/somerepo/.git equivalent is a directory.  Perhas yours
is not?  That should not cause any difference and it is merely a
guess in the dark.


  reply	other threads:[~2023-04-11 16:58 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-11 16:05 Bug with git-config includeIf Matthias Beyer
2023-04-11 16:58 ` Junio C Hamano [this message]
2023-04-12  6:26   ` Matthias Beyer
2023-04-11 17:00 ` Emily Shaffer

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=xmqqr0sq9x0f.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=mail@beyermatthias.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox