{"thread":{"id":"53168","subject":"Fwd: Q: use '-C' flag with 'git config --global'","startedAt":"2020-04-06T08:48:23Z","lastAt":"2020-04-06T18:05:11Z","messageCount":4,"participants":["Tomáš Procházka","Jeff King","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"394821","messageId":"CA+Sgv42bOAaRBX99EpgpnSkGXFCWFpED7hwdwkWmPSOKuL1VBg@mail.gmail.com","threadId":"53168","inReplyTo":"CA+Sgv42V+xfoJVoFpPkWREXT0yuKZDeMDEGa3y8NDVU-4D1iYA@mail.gmail.com","subject":"Fwd: Q: use '-C' flag with 'git config --global'","fromName":"Tomáš Procházka","fromEmail":"tomas.prochazka5d@gmail.com","sentAt":"2020-04-06T08:48:06Z","receivedAt":"2020-04-06T08:48:23Z","isPatch":false,"sender":{"key":"tomas.prochazka5d@gmail.com","avatar":null},"body":"Hi,\n\nI'm running into issue that if I run `git -C <pwd/to/showmax/project>\nconfig --global user.email` I don't get expected email.\nExpected: tomas.prochazka@showmax.com\nGot: tomas.prochazka5d@gmail.com\n\nMy config contains a little catch:\n\n~/.gitconfig\n```\n[user]\n       name = Tomáš Procházka\n       email = tomas.prochazka5d@gmail.com\n\n[includeIf \"gitdir:~/Workspace/Showmax/\"]\n   path = ~/Workspace/Showmax/.gitconfig\n```\n~/Workspace/Showmax/.gitconfig\n```\n[user]\n    name = Tomáš Procházka\n    email = tomas.prochazka@showmax.com\n```\n\nI get correct email setting if I run command without `--global` flag.\nBut What I understand from the [`git-config`\ndocs](https://git-scm.com/docs/git-config#_description) if no flag is\npassed the values are read from system, global and local.\n\nIf I run commands one by one, No returns the ~correct~ expected email:\n\n~ $ git -C <pwd/to/showmax/project> config --system user.email\n~ $ git -C <pwd/to/showmax/project> config --global user.email\ntomas.prochazka5d@gmail.com\n~ $ git -C <pwd/to/showmax/project> config --local user.email\n\nAm I missing something?\nThanks for the answer.\n\nRegards\nTomáš Procházka\n"},{"id":"394829","messageId":"20200406130524.GA1276@coredump.intra.peff.net","threadId":"53168","inReplyTo":"CA+Sgv42bOAaRBX99EpgpnSkGXFCWFpED7hwdwkWmPSOKuL1VBg@mail.gmail.com","subject":"Re: Fwd: Q: use '-C' flag with 'git config --global'","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2020-04-06T13:05:24Z","receivedAt":"2020-04-06T13:05:27Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, Apr 06, 2020 at 10:48:06AM +0200, Tomáš Procházka wrote:\n\n> [includeIf \"gitdir:~/Workspace/Showmax/\"]\n>    path = ~/Workspace/Showmax/.gitconfig\n> [...]\n> I get correct email setting if I run command without `--global` flag.\n> But What I understand from the [`git-config`\n> docs](https://git-scm.com/docs/git-config#_description) if no flag is\n> passed the values are read from system, global and local.\n\nRight, I'd expect that to work, but...\n\n> If I run commands one by one, No returns the ~correct~ expected email:\n> \n> ~ $ git -C <pwd/to/showmax/project> config --system user.email\n> ~ $ git -C <pwd/to/showmax/project> config --global user.email\n> tomas.prochazka5d@gmail.com\n> ~ $ git -C <pwd/to/showmax/project> config --local user.email\n\nThere's another difference when asking to read from a specific file:\nincludes are not turned on by default. Try\n\n  git -C ... config --global --includes user.email\n\nThis is covered briefly in git-config(1):\n\n  --[no-]includes\n    Respect include.* directives in config files when looking up values.\n    Defaults to off when a specific file is given (e.g., using --file,\n    --global, etc) and on when searching all config files.\n\nThis can be confusing, but was necessary to keep compatibility with\nscripted manipulations of those files when includes were introduced.\n\n-Peff\n"},{"id":"394870","messageId":"xmqq4ktwwl1g.fsf@gitster.c.googlers.com","threadId":"53168","inReplyTo":"20200406130524.GA1276@coredump.intra.peff.net","subject":"Re: Fwd: Q: use '-C' flag with 'git config --global'","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2020-04-06T18:01:31Z","receivedAt":"2020-04-06T18:01:38Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> On Mon, Apr 06, 2020 at 10:48:06AM +0200, Tomáš Procházka wrote:\n>\n>> [includeIf \"gitdir:~/Workspace/Showmax/\"]\n>>    path = ~/Workspace/Showmax/.gitconfig\n>> [...]\n>> I get correct email setting if I run command without `--global` flag.\n>> But What I understand from the [`git-config`\n>> docs](https://git-scm.com/docs/git-config#_description) if no flag is\n>> passed the values are read from system, global and local.\n>\n> Right, I'd expect that to work, but...\n>\n>> If I run commands one by one, No returns the ~correct~ expected email:\n>> \n>> ~ $ git -C <pwd/to/showmax/project> config --system user.email\n>> ~ $ git -C <pwd/to/showmax/project> config --global user.email\n>> tomas.prochazka5d@gmail.com\n>> ~ $ git -C <pwd/to/showmax/project> config --local user.email\n>\n> There's another difference when asking to read from a specific file:\n> includes are not turned on by default. Try\n>\n>   git -C ... config --global --includes user.email\n>\n> This is covered briefly in git-config(1):\n>\n>   --[no-]includes\n>     Respect include.* directives in config files when looking up values.\n>     Defaults to off when a specific file is given (e.g., using --file,\n>     --global, etc) and on when searching all config files.\n>\n> This can be confusing, but was necessary to keep compatibility with\n> scripted manipulations of those files when includes were introduced.\n\nSo, in short, the mention of -C in the report was red herring and it\nwas all about --(system|global|local)?\n"},{"id":"394871","messageId":"20200406180508.GA23427@coredump.intra.peff.net","threadId":"53168","inReplyTo":"xmqq4ktwwl1g.fsf@gitster.c.googlers.com","subject":"Re: Fwd: Q: use '-C' flag with 'git config --global'","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2020-04-06T18:05:08Z","receivedAt":"2020-04-06T18:05:11Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, Apr 06, 2020 at 11:01:31AM -0700, Junio C Hamano wrote:\n\n> > There's another difference when asking to read from a specific file:\n> > includes are not turned on by default. Try\n> >\n> >   git -C ... config --global --includes user.email\n> >\n> > This is covered briefly in git-config(1):\n> >\n> >   --[no-]includes\n> >     Respect include.* directives in config files when looking up values.\n> >     Defaults to off when a specific file is given (e.g., using --file,\n> >     --global, etc) and on when searching all config files.\n> >\n> > This can be confusing, but was necessary to keep compatibility with\n> > scripted manipulations of those files when includes were introduced.\n> \n> So, in short, the mention of -C in the report was red herring and it\n> was all about --(system|global|local)?\n\nYes. It's relevant insofar as being in the repo to trigger the\nconditional include, but \"cd\" would also have sufficed for that. :)\n\n-Peff\n"}]}