git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: "Tomáš Procházka" <tomas.prochazka5d@gmail.com>
Cc: git@vger.kernel.org, tomas.volf@showmax.com
Subject: Re: Fwd: Q: use '-C' flag with 'git config --global'
Date: Mon, 6 Apr 2020 09:05:24 -0400	[thread overview]
Message-ID: <20200406130524.GA1276@coredump.intra.peff.net> (raw)
In-Reply-To: <CA+Sgv42bOAaRBX99EpgpnSkGXFCWFpED7hwdwkWmPSOKuL1VBg@mail.gmail.com>

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

  reply	other threads:[~2020-04-06 13:05 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [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 [this message]
2020-04-06 18:01     ` Junio C Hamano
2020-04-06 18:05       ` Jeff King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200406130524.GA1276@coredump.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=tomas.prochazka5d@gmail.com \
    --cc=tomas.volf@showmax.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).