* Fwd: Q: use '-C' flag with 'git config --global'
[not found] <CA+Sgv42V+xfoJVoFpPkWREXT0yuKZDeMDEGa3y8NDVU-4D1iYA@mail.gmail.com>
@ 2020-04-06 8:48 ` Tomáš Procházka
2020-04-06 13:05 ` Jeff King
0 siblings, 1 reply; 4+ messages in thread
From: Tomáš Procházka @ 2020-04-06 8:48 UTC (permalink / raw)
To: git; +Cc: tomas.volf
Hi,
I'm running into issue that if I run `git -C <pwd/to/showmax/project>
config --global user.email` I don't get expected email.
Expected: tomas.prochazka@showmax.com
Got: tomas.prochazka5d@gmail.com
My config contains a little catch:
~/.gitconfig
```
[user]
name = Tomáš Procházka
email = tomas.prochazka5d@gmail.com
[includeIf "gitdir:~/Workspace/Showmax/"]
path = ~/Workspace/Showmax/.gitconfig
```
~/Workspace/Showmax/.gitconfig
```
[user]
name = Tomáš Procházka
email = tomas.prochazka@showmax.com
```
I get correct email setting if I run command without `--global` flag.
But What I understand from the [`git-config`
docs](https://git-scm.com/docs/git-config#_description) if no flag is
passed the values are read from system, global and local.
If I run commands one by one, No returns the ~correct~ expected email:
~ $ git -C <pwd/to/showmax/project> config --system user.email
~ $ git -C <pwd/to/showmax/project> config --global user.email
tomas.prochazka5d@gmail.com
~ $ git -C <pwd/to/showmax/project> config --local user.email
Am I missing something?
Thanks for the answer.
Regards
Tomáš Procházka
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Fwd: Q: use '-C' flag with 'git config --global'
2020-04-06 8:48 ` Fwd: Q: use '-C' flag with 'git config --global' Tomáš Procházka
@ 2020-04-06 13:05 ` Jeff King
2020-04-06 18:01 ` Junio C Hamano
0 siblings, 1 reply; 4+ messages in thread
From: Jeff King @ 2020-04-06 13:05 UTC (permalink / raw)
To: Tomáš Procházka; +Cc: git, tomas.volf
On Mon, Apr 06, 2020 at 10:48:06AM +0200, Tomáš Procházka wrote:
> [includeIf "gitdir:~/Workspace/Showmax/"]
> path = ~/Workspace/Showmax/.gitconfig
> [...]
> I get correct email setting if I run command without `--global` flag.
> But What I understand from the [`git-config`
> docs](https://git-scm.com/docs/git-config#_description) if no flag is
> passed the values are read from system, global and local.
Right, I'd expect that to work, but...
> If I run commands one by one, No returns the ~correct~ expected email:
>
> ~ $ git -C <pwd/to/showmax/project> config --system user.email
> ~ $ git -C <pwd/to/showmax/project> config --global user.email
> tomas.prochazka5d@gmail.com
> ~ $ git -C <pwd/to/showmax/project> config --local user.email
There's another difference when asking to read from a specific file:
includes are not turned on by default. Try
git -C ... config --global --includes user.email
This is covered briefly in git-config(1):
--[no-]includes
Respect include.* directives in config files when looking up values.
Defaults to off when a specific file is given (e.g., using --file,
--global, etc) and on when searching all config files.
This can be confusing, but was necessary to keep compatibility with
scripted manipulations of those files when includes were introduced.
-Peff
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Fwd: Q: use '-C' flag with 'git config --global'
2020-04-06 13:05 ` Jeff King
@ 2020-04-06 18:01 ` Junio C Hamano
2020-04-06 18:05 ` Jeff King
0 siblings, 1 reply; 4+ messages in thread
From: Junio C Hamano @ 2020-04-06 18:01 UTC (permalink / raw)
To: Jeff King; +Cc: Tomáš Procházka, git, tomas.volf
Jeff King <peff@peff.net> writes:
> On Mon, Apr 06, 2020 at 10:48:06AM +0200, Tomáš Procházka wrote:
>
>> [includeIf "gitdir:~/Workspace/Showmax/"]
>> path = ~/Workspace/Showmax/.gitconfig
>> [...]
>> I get correct email setting if I run command without `--global` flag.
>> But What I understand from the [`git-config`
>> docs](https://git-scm.com/docs/git-config#_description) if no flag is
>> passed the values are read from system, global and local.
>
> Right, I'd expect that to work, but...
>
>> If I run commands one by one, No returns the ~correct~ expected email:
>>
>> ~ $ git -C <pwd/to/showmax/project> config --system user.email
>> ~ $ git -C <pwd/to/showmax/project> config --global user.email
>> tomas.prochazka5d@gmail.com
>> ~ $ git -C <pwd/to/showmax/project> config --local user.email
>
> There's another difference when asking to read from a specific file:
> includes are not turned on by default. Try
>
> git -C ... config --global --includes user.email
>
> This is covered briefly in git-config(1):
>
> --[no-]includes
> Respect include.* directives in config files when looking up values.
> Defaults to off when a specific file is given (e.g., using --file,
> --global, etc) and on when searching all config files.
>
> This can be confusing, but was necessary to keep compatibility with
> scripted manipulations of those files when includes were introduced.
So, in short, the mention of -C in the report was red herring and it
was all about --(system|global|local)?
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Fwd: Q: use '-C' flag with 'git config --global'
2020-04-06 18:01 ` Junio C Hamano
@ 2020-04-06 18:05 ` Jeff King
0 siblings, 0 replies; 4+ messages in thread
From: Jeff King @ 2020-04-06 18:05 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Tomáš Procházka, git, tomas.volf
On Mon, Apr 06, 2020 at 11:01:31AM -0700, Junio C Hamano wrote:
> > There's another difference when asking to read from a specific file:
> > includes are not turned on by default. Try
> >
> > git -C ... config --global --includes user.email
> >
> > This is covered briefly in git-config(1):
> >
> > --[no-]includes
> > Respect include.* directives in config files when looking up values.
> > Defaults to off when a specific file is given (e.g., using --file,
> > --global, etc) and on when searching all config files.
> >
> > This can be confusing, but was necessary to keep compatibility with
> > scripted manipulations of those files when includes were introduced.
>
> So, in short, the mention of -C in the report was red herring and it
> was all about --(system|global|local)?
Yes. It's relevant insofar as being in the repo to trigger the
conditional include, but "cd" would also have sufficed for that. :)
-Peff
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-04-06 18:05 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <CA+Sgv42V+xfoJVoFpPkWREXT0yuKZDeMDEGa3y8NDVU-4D1iYA@mail.gmail.com>
2020-04-06 8:48 ` Fwd: Q: use '-C' flag with 'git config --global' Tomáš Procházka
2020-04-06 13:05 ` Jeff King
2020-04-06 18:01 ` Junio C Hamano
2020-04-06 18:05 ` Jeff King
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).