# Possible bug in includeIf / conditional includes on non git initialised directories

4 messages from 2017-05-11 to 2017-05-12. Participants: Raphael Stolt, Sebastian Schuberth, Jeff King, Ævar Arnfjörð Bjarmason.
Thread: https://gitlist.dev/t/45938

## Raphael Stolt, 2017-05-11 18:53

Subject: Possible bug in includeIf / conditional includes on non git initialised directories
Message-ID: <F55DC360-9C1E-45B9-B8BA-39E1001BD620@gmail.com>
URL: https://gitlist.dev/e/F55DC360-9C1E-45B9-B8BA-39E1001BD620%40gmail.com

```
Hi there,

I might have stumbled this time over a real bug in includeIf / conditional includes or maybe it's just as intended.
1) Given I have a correct configured includeIf and I’m issuing `git config --show-origin --get user.email` against an directory which hasn’t been `git init`ed I get the user.email configured globally.
2) Given I have a correct configured includeIf and I’m issuing `git config --show-origin --get user.email` against an directory which has been `git init`ed I get the user.email configured conditionally.
For 1) I would probably expect to get the user.email configured conditionally even for a plain directory.

More details see this (http://stackoverflow.com/questions/43919191/git-2-13-conditional-config-on-windows/) Stack Overflow question.
Best regards,
Raphael Stolt






```

## Sebastian Schuberth, 2017-05-11 20:31

Subject: Re: Possible bug in includeIf / conditional includes on non git initialised directories
Message-ID: <5735fdc6-85de-491c-481d-9d0c18912ee6@gmail.com>
URL: https://gitlist.dev/e/5735fdc6-85de-491c-481d-9d0c18912ee6%40gmail.com
In-Reply-To: <F55DC360-9C1E-45B9-B8BA-39E1001BD620@gmail.com>

```
On 2017-05-11 20:53, Raphael Stolt wrote:

> I might have stumbled this time over a real bug in includeIf / conditional includes or maybe it's just as intended.
> 1) Given I have a correct configured includeIf and I’m issuing `git config --show-origin --get user.email` against an directory which hasn’t been `git init`ed I get the user.email configured globally.

I don't think that's a bug surprise: The condition in the conditional include is "gitdir:". Before running "git init", it simply *is* no gitdir.

-- 
Sebastian Schuberth

```

## Jeff King, 2017-05-11 23:43

Subject: Re: Possible bug in includeIf / conditional includes on non git initialised directories
Message-ID: <20170511234259.gnbr6aiu26oqysxo@sigill.intra.peff.net>
URL: https://gitlist.dev/e/20170511234259.gnbr6aiu26oqysxo%40sigill.intra.peff.net
In-Reply-To: <5735fdc6-85de-491c-481d-9d0c18912ee6@gmail.com>

```
On Thu, May 11, 2017 at 10:31:14PM +0200, Sebastian Schuberth wrote:

> On 2017-05-11 20:53, Raphael Stolt wrote:
> 
> > I might have stumbled this time over a real bug in includeIf / conditional includes or maybe it's just as intended.
> > 1) Given I have a correct configured includeIf and I’m issuing `git config --show-origin --get user.email` against an directory which hasn’t been `git init`ed I get the user.email configured globally.
> 
> I don't think that's a bug surprise: The condition in the conditional
> include is "gitdir:". Before running "git init", it simply *is* no
> gitdir.

Yeah, I think all is working as intended. A "cwd:" conditional seems
like it would be useful, but I think it would have a lot of corner
cases. It may change over the course of a program, and you have
weirdness with things like "git --git-dir=/some/other/path", where your
cwd and the git repository you're looking at are totally unrelated.

-Peff

```

## Ævar Arnfjörð Bjarmason, 2017-05-12 08:58

Subject: Re: Possible bug in includeIf / conditional includes on non git initialised directories
Message-ID: <CACBZZX7-Gw7G7yY=ah6AQCJKzWKB002iAo6RNJwZmvMRe4Pd+w@mail.gmail.com>
URL: https://gitlist.dev/e/CACBZZX7-Gw7G7yY%3Dah6AQCJKzWKB002iAo6RNJwZmvMRe4Pd%2Bw%40mail.gmail.com
In-Reply-To: <F55DC360-9C1E-45B9-B8BA-39E1001BD620@gmail.com>

```
On Thu, May 11, 2017 at 8:53 PM, Raphael Stolt <raphael.stolt@gmail.com> wrote:
> Hi there,
>
> I might have stumbled this time over a real bug in includeIf / conditional includes or maybe it's just as intended.
> 1) Given I have a correct configured includeIf and I’m issuing `git config --show-origin --get user.email` against an directory which hasn’t been `git init`ed I get the user.email configured globally.
> 2) Given I have a correct configured includeIf and I’m issuing `git config --show-origin --get user.email` against an directory which has been `git init`ed I get the user.email configured conditionally.
> For 1) I would probably expect to get the user.email configured conditionally even for a plain directory.
>
> More details see this (http://stackoverflow.com/questions/43919191/git-2-13-conditional-config-on-windows/) Stack Overflow question.
> Best regards,
> Raphael Stolt

The "this is how this works" has been covered already by others, but
can you elaborate on the use-case, why does it matter for you that
"git config" doesn't show your user.email when you have no git dir
there, I can't think of a reason for why this would matter since
there's no .git there, so there's no way anything can use the config
info at that location.

```
