Skip to contentSkip to conversation

includeIf appears to not be working

DISCUSSION Joshua J. Kugler 3 participants 5 messages Dec 12, 2022

lore
Share & tools
lore
#0 lore raw

So, I've set up includeIf before, and have had it working, but it seems to not be working in my latest attempt.

This is git 2.38.2 on Ubuntu Linux 20.04.

Contents of ~/.gitconfig (truncated):

[user]
name = Joshua Kugler
email = [email protected]
[includIf "gitdir:~/repos/work/"]
path = ~/repos/work/gitconfig

Contents of ~/repos/work/gitconfig:

[user]
name = Joshua Kugler
email = [email protected]

Now, if I do this:

cd /home/jkugler/repos/work/some_repo

and run:

$ git config --show-origin --get user.email
file:/home/jkugler/.gitconfig   [email protected]

Like I said, I've set this up before, and had it working. I don't know what I'm doing differently/wrong...but would be happy to be told so.

Is there a debug command which can show if the gitdir is/isn't matching like I thought it should? What other command output could help debug this?

Thanks!

j

Signature · 3 lines
Joshua J. Kugler - Fairbanks, Alaska - [email protected]
Azariah Enterprises - Programming and Website Design
PGP Key: http://pgp.mit.edu/  ID 0x68108cbb73b13b6a
#1 lore raw
Quoted 9 lines · Joshua J. Kugler

So, I've set up includeIf before, and have had it working, but it seems to not be working in my latest attempt.

Contents of ~/.gitconfig (truncated):

[user]
name = Joshua Kugler
email = [email protected]
[includIf "gitdir:~/repos/work/"]

Missing "e" in "includeIf".

#2 lore raw

All -

Yep, that was copy/paste verbatim, and yep, that was the issue.

Thank you to all who spotted the missing "e". Siiiiigh. I looked at that so many times, and didn't even see it.

Sorry to waste your time, and I much appreciate the quick response!

j

Quoted 14 lines · AKST Eric Sunshine
Quoted 11 lines · Joshua J. Kugler

So, I've set up includeIf before, and have had it working, but it seems to not be working in my latest attempt.

Contents of ~/.gitconfig (truncated):

[user]

name = Joshua Kugler
email = [email protected]

[includIf "gitdir:~/repos/work/"]

Missing "e" in "includeIf".

Signature · 3 lines
Joshua J. Kugler - Fairbanks, Alaska - [email protected]
Azariah Enterprises - Programming and Website Design
PGP Key: http://pgp.mit.edu/  ID 0x68108cbb73b13b6a
#3 lore raw
In reply to Joshua J. Kugler
Quoted 7 lines · Joshua J. Kugler

Contents of ~/.gitconfig (truncated):

[user]
name = Joshua Kugler
email = [email protected]
[includIf "gitdir:~/repos/work/"]
path = ~/repos/work/gitconfig

Maybe a dumb question, but is this cut-and-paste verbatim? If so, then perhaps s/includ/include/ would help?

With that change, your example works for me.

Quoted 2 lines

Like I said, I've set this up before, and had it working. I don't know what I'm doing differently/wrong...but would be happy to be told so.

If it's not the typo, then possibly there are symlinks involved? We'll run realpath() on the repository directory before matching, so your pattern needs to take that into account.

Quoted 3 lines

Is there a debug command which can show if the gitdir is/isn't matching like I thought it should? What other command output could help debug this?

No, there's no debug/tracing code for this feature. You'd have to run it under gdb (break on the include_by_gitdir function).

-Peff

#4 lore raw
Quoted 6 lines · Jeff King
Quoted 3 lines

Is there a debug command which can show if the gitdir is/isn't matching like I thought it should? What other command output could help debug this?

No, there's no debug/tracing code for this feature. You'd have to run it under gdb (break on the include_by_gitdir function).

Oh, one other command you could try:

  git rev-parse --absolute-git-dir

while in the repository in question. I think that would do the same normalization of the path (including resolving symlinks). So that would tell you what Git should be matching against.

-Peff