git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Colton Hurst <colton@coltonhurst.com>
Cc: git@vger.kernel.org
Subject: Re: Git Conditional Includes Question (possible bug?)
Date: Fri, 29 Jan 2021 14:54:48 -0800	[thread overview]
Message-ID: <xmqqlfcbs69z.fsf@gitster.c.googlers.com> (raw)
In-Reply-To: <1E4AB5E8-DD46-45CA-9A3F-C49F115BE0D4@coltonhurst.com> (Colton Hurst's message of "Fri, 29 Jan 2021 16:21:44 -0500")

Colton Hurst <colton@coltonhurst.com> writes:

> [Expectation] When I run `cd ~/colton/github/coltonhurst.com`
> (this is a valid git repo) and then run `git config user.email`, I
> expect ‘colton@coltonhurst.com’ will be returned.
>
> [Actual Result] When I run `cd ~/colton/github/coltonhurst.com`
> (this is a valid git repo) and then run `git config user.email`,
> nothing is returned.

The relevant part of the per-user config are

> [user]
> 	name = Colton Hurst

This is not conditional, and applies when you are in the repository.

> [includeIf "gitdir:~/colton/github"]
> 	path = ~/colton/github/.gitconfig

This is conditional, and applies when you are in a repository whose
".git" location matches the glob pattern "~/colton/github".  The
location in question is "~/colton/github/coltonhurst.com", which
does not match the pattern, so it would be skipped.

> [includeIf "gitdir:~/colton/sourcehut"]
> 	path = ~/colton/sourcehut/.gitconfig

Likewise.

So, nobody sets user.email in your example.  Isn't it expected that
nothing is returned?

I wonder what happens when the second one is updated to

> [includeIf "gitdir:~/colton/github/"]
> 	path = ~/colton/github/.gitconfig

as "git config --help" says:

 * If the pattern ends with `/`, `**` will be automatically added. For
   example, the pattern `foo/` becomes `foo/**`. In other words, it
   matches "foo" and everything inside, recursively.

and "~/colton/github/**" as a pattern would match the path to the
repository in question.


  reply	other threads:[~2021-01-29 22:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-29 21:21 Git Conditional Includes Question (possible bug?) Colton Hurst
2021-01-29 22:54 ` Junio C Hamano [this message]
2021-01-31  4:23   ` Colton Hurst

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=xmqqlfcbs69z.fsf@gitster.c.googlers.com \
    --to=gitster@pobox.com \
    --cc=colton@coltonhurst.com \
    --cc=git@vger.kernel.org \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).