{"thread":{"id":"45938","subject":"Possible bug in includeIf / conditional includes on non git initialised directories","startedAt":"2017-05-11T18:53:49Z","lastAt":"2017-05-12T18:44:57Z","messageCount":4,"participants":["Raphael Stolt","Sebastian Schuberth","Jeff King","Ævar Arnfjörð Bjarmason"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"319438","messageId":"F55DC360-9C1E-45B9-B8BA-39E1001BD620@gmail.com","threadId":"45938","inReplyTo":null,"subject":"Possible bug in includeIf / conditional includes on non git initialised directories","fromName":"Raphael Stolt","fromEmail":"raphael.stolt@gmail.com","sentAt":"2017-05-11T18:53:41Z","receivedAt":"2017-05-11T18:53:49Z","isPatch":false,"sender":{"key":"raphael.stolt@gmail.com","avatar":"https://gravatar.com/avatar/132faf5713fa951f4263fad02858a62e55c5d832ad775b33e49ba0cda2f2a028?d=mp&s=160"},"body":"Hi there,\n\nI might have stumbled this time over a real bug in includeIf / conditional includes or maybe it's just as intended.\n1) 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.\n2) 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.\nFor 1) I would probably expect to get the user.email configured conditionally even for a plain directory.\n\nMore details see this (http://stackoverflow.com/questions/43919191/git-2-13-conditional-config-on-windows/) Stack Overflow question.\nBest regards,\nRaphael Stolt\n\n\n\n\n\n"},{"id":"319459","messageId":"5735fdc6-85de-491c-481d-9d0c18912ee6@gmail.com","threadId":"45938","inReplyTo":"F55DC360-9C1E-45B9-B8BA-39E1001BD620@gmail.com","subject":"Re: Possible bug in includeIf / conditional includes on non git initialised directories","fromName":"Sebastian Schuberth","fromEmail":"sschuberth@gmail.com","sentAt":"2017-05-11T20:31:14Z","receivedAt":"2017-05-11T20:31:27Z","isPatch":false,"sender":{"key":"sschuberth@gmail.com","avatar":"https://avatars.githubusercontent.com/u/349154?v=4"},"body":"On 2017-05-11 20:53, Raphael Stolt wrote:\n\n> I might have stumbled this time over a real bug in includeIf / conditional includes or maybe it's just as intended.\n> 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.\n\nI 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.\n\n-- \nSebastian Schuberth\n"},{"id":"319488","messageId":"20170511234259.gnbr6aiu26oqysxo@sigill.intra.peff.net","threadId":"45938","inReplyTo":"5735fdc6-85de-491c-481d-9d0c18912ee6@gmail.com","subject":"Re: Possible bug in includeIf / conditional includes on non git initialised directories","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2017-05-11T23:43:00Z","receivedAt":"2017-05-11T23:43:06Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, May 11, 2017 at 10:31:14PM +0200, Sebastian Schuberth wrote:\n\n> On 2017-05-11 20:53, Raphael Stolt wrote:\n> \n> > I might have stumbled this time over a real bug in includeIf / conditional includes or maybe it's just as intended.\n> > 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.\n> \n> I don't think that's a bug surprise: The condition in the conditional\n> include is \"gitdir:\". Before running \"git init\", it simply *is* no\n> gitdir.\n\nYeah, I think all is working as intended. A \"cwd:\" conditional seems\nlike it would be useful, but I think it would have a lot of corner\ncases. It may change over the course of a program, and you have\nweirdness with things like \"git --git-dir=/some/other/path\", where your\ncwd and the git repository you're looking at are totally unrelated.\n\n-Peff\n"},{"id":"319514","messageId":"CACBZZX7-Gw7G7yY=ah6AQCJKzWKB002iAo6RNJwZmvMRe4Pd+w@mail.gmail.com","threadId":"45938","inReplyTo":"F55DC360-9C1E-45B9-B8BA-39E1001BD620@gmail.com","subject":"Re: Possible bug in includeIf / conditional includes on non git initialised directories","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2017-05-12T08:58:24Z","receivedAt":"2017-05-12T18:44:57Z","isPatch":false,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"On Thu, May 11, 2017 at 8:53 PM, Raphael Stolt <raphael.stolt@gmail.com> wrote:\n> Hi there,\n>\n> I might have stumbled this time over a real bug in includeIf / conditional includes or maybe it's just as intended.\n> 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.\n> 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.\n> For 1) I would probably expect to get the user.email configured conditionally even for a plain directory.\n>\n> More details see this (http://stackoverflow.com/questions/43919191/git-2-13-conditional-config-on-windows/) Stack Overflow question.\n> Best regards,\n> Raphael Stolt\n\nThe \"this is how this works\" has been covered already by others, but\ncan you elaborate on the use-case, why does it matter for you that\n\"git config\" doesn't show your user.email when you have no git dir\nthere, I can't think of a reason for why this would matter since\nthere's no .git there, so there's no way anything can use the config\ninfo at that location.\n"}]}