git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Stuart MacDonald <stuartm.coding@gmail.com>
To: Jeff King <peff@peff.net>
Cc: Junio C Hamano <gitster@pobox.com>, git@vger.kernel.org
Subject: Re: [Bug report] includeIf config is not displayed in normal directories
Date: Wed, 16 Dec 2020 15:43:31 -0500	[thread overview]
Message-ID: <CAPQE4+rhWT9kgusNXOw5cnJ-oFq++4G1FMaXvQ3wppQ0GE0hSA@mail.gmail.com> (raw)
In-Reply-To: <X9pe119edtL5KQTU@coredump.intra.peff.net>

On Wed, Dec 16, 2020 at 2:24 PM Jeff King <peff@peff.net> wrote:
> Perhaps. I have no objection to adding an option like that. But I don't
> think it solves the fundamental issue in this bug report, which is
> asking "what will the config look like in a repository that I created at
> this path via git-init or git-clone?".

My fundamental issue was "git is using a conditionally included config
option core.sshCommand while outside of a git repository, but git config
is not displaying that config option when I ask it to". The good news is
given the discussion in this thread I can now say that I was labouring
under a misconception about how git clone works, and what I thought
was a bug is normal expected behaviour.

My old understanding of git clone:
- create sub-directory
- create subdir/.git and whatever initial states are needed
- clone the repo from origin into the directory
- all never having left $CWD

It's actually:
- create sub-directory
- cd subdir
- create ./.git and initial states
- clone the repo _while inside_ a gitdir
- cd ..

I would like to suggest that the documentation for either or both
git clone and includeIf could be improved to talk about this case so
that others having trouble with a conditionally included sshComand
during cloning will not have to relearn the wheel.

I believe my misunderstanding was partially misled by the fact that
despite the documentation for includeIf talking about it being a gitdir
the part of that path being matched is not itself within a git directory;
~/work/git/git/.git was the end result, ~/work being the matched on
part of the path and not in a git directory.

> Maybe Stuart really would prefer to change his config to "whenever I am
> in this directory root, repo or no, use this config". It does have weird
> corner cases around "git --git-dir=/path/to/repo", but doing that from
> another directory is perhaps rare enough that people using a cwd:
> conditional would be happy to ignore that.

I do not. Hopefully this thread will also assist future includeIf
trouble-havers.

Thanks all, very much appreciated. I consider the matter settled
as 'working as designed'.

  reply	other threads:[~2020-12-16 20:45 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-15 15:52 [Bug report] includeIf config is not displayed in normal directories Stuart MacDonald
2017-05-11 18:53 ` Possible bug in includeIf / conditional includes on non git initialised directories Raphael Stolt
2017-05-11 20:31   ` Sebastian Schuberth
2017-05-11 23:43     ` Jeff King
2017-05-12  8:58   ` Ævar Arnfjörð Bjarmason
2020-12-15 23:03     ` [Bug report] includeIf config is not displayed in normal directories Ævar Arnfjörð Bjarmason
2020-12-16  0:23       ` Junio C Hamano
2020-12-15 22:23 ` Junio C Hamano
2020-12-16 19:24   ` Jeff King
2020-12-16 20:43     ` Stuart MacDonald [this message]
2020-12-16 23:24       ` Junio C Hamano
2020-12-18  6:23         ` 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

  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=CAPQE4+rhWT9kgusNXOw5cnJ-oFq++4G1FMaXvQ3wppQ0GE0hSA@mail.gmail.com \
    --to=stuartm.coding@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=peff@peff.net \
    /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).