Re: [PATCH] push: change submodule default to check
- From
Jeff King <peff@peff.net>
- Date
- Oct 4, 2016, 17:54 UTC
- Message-ID
- <20161004175449.gn5cw6wcbvloqkzj@sigill.intra.peff.net>
- In-Reply-To
- <CAGZ79kaKOjqLBsNVSmudzLUCkOJf_CsFGE8OZZHsTmuXCfiVeg@mail.gmail.com>
On Tue, Oct 04, 2016 at 10:48:51AM -0700, Stefan Beller wrote:
Show 6 quoted lines
> > This does seem like a reasonable heuristic. I wonder if you want to > > confirm that we actually have a worktree (and are in it) before looking > > at file_exists(). It's unlikely that looking at ".gitmodules" in a bare > > repo would trigger in practice, but it does not hurt to be careful. > > In a bare repo we'd rather want to check for an entry of .gitmodules in HEAD ?
Yeah, I think that is the closest equivalent.
> I considered it a non issue, as I don't think many people push from > bare repositories.
I'd also agree, and I have no problem if there simply _isn't_ an auto heuristic for bare repos. Mostly I just thought blindly calling file_exists() was ugly (especially after all the recent "whoops, we look at .git/config in the wrong directory" fixes I've been doing lately).
Show 6 quoted lines
> Here is another thought: > .gitmodules may not exist (either in working dir or in HEADs git > tree), so maybe the > "correct" heuristic is to check for directories in $GIT_DIR/modules/ > That is "more correct", because it is inconceivable to change the submodule > pointers without having the submodules checked out. (Who would do that? Why?)
Actually, I like that a bit better. It would not cover the case where you have not actually checked out any of the submodules (or at least not called "submodule init", I guess?). But arguably that is a sign that the auto-recurse behavior should not be kicking in anyway.
Bearing in mind that I am not too familiar with what's normal in the submodule world, and so might be spouting nonsense. :)
-Peff