Re: [Bug report] includeIf config is not displayed in normal directories

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Dec 15, 2020 at 02:23:17PM -0800, Junio C Hamano wrote:

> > $ git clone --recursive git@xxxxxxxxxx:git/git.git
> > OBSERVE B: The clone succeeds
> 
> This may be an unexpected but is an understandable behaviour.
> 
> First the command has to create an empty repository with an initial
> configuration file, and at that point [includeif "gitdir:*"] match
> would notice that there is a gitdir at $(pwd)/.git; by the time the
> command actually starts talking to the other side, the repository
> specific configuration can be picked up.

I think this is not just unexpected, but something we've explicitly
tried to make work. After creating the repository, we re-read the config
in order to pick up any "clone -c" options. I'm not sure if anybody
thought about how includeIf would interact here, but I think it is quite
logical to say "now that we are in a repository, these config options
that are conditional on being in a particular repository will take
effect". I.e., expecting it not to work is making assumptions about
the timing of when Git locks in the value of config options.

> And you are outside any repository, so there shouldn't be any gitdir
> in effect to influence [includeif "gitdir:*"] matching.
> 
> Another option, as Peff suggested in the old thread, would be to
> introduce a separate [includeif "cwd:*"] match, but I do not know
> how well it would fly.  with that, you may be able to
> 
> 	[includeif "cwd:/home/stuart/work/*"]
> 		path = ...
> 
> I think that may be cleaner than the "pretend we have already a
> git-dir here" hack I mentioned earlier, but I didn't think things
> through.

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?".

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.

But if we do want to solve it, then your --pretend-git-dir is doing that
directly. I don't think it's terribly useful in general, but it could be
a debugging aid.

-Peff



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux