Re: [PATCH v3 1/4] for-each-repo: test outside of repo context
- From
Derrick Stolee <stolee@gmail.com>
- Date
- Mar 2, 2026, 18:36 UTC
- Message-ID
- <c747c645-7773-44e8-9d1a-74f5eb89e318@gmail.com>
- In-Reply-To
- <xmqqpl5m13s7.fsf@gitster.g>
On 3/2/2026 1:31 PM, Junio C Hamano wrote:
Show 25 quoted lines
> Jeff King <peff@peff.net> writes: > >> On Mon, Mar 02, 2026 at 03:36:42PM +0000, Derrick Stolee via GitGitGadget wrote: >> >>> test_description='git for-each-repo builtin' >>> >>> +# We need to test running 'git for-each-repo' outside of a repo context. >>> +TEST_NO_CREATE_REPO=1 >>> + >>> . ./test-lib.sh >> >> Interesting. I was going to point out that this won't do what you want >> by itself, because Git will keep walking out of the trash directory and >> may find the containing repository. >> >> But it looks like this should be enough due to 614c3d8f2e (test-lib: set >> GIT_CEILING_DIRECTORIES to protect the surrounding repository, >> 2021-08-29). Supporting this case wasn't the intent of that patch, but I >> don't see any reason why it should not work reliably. > > I am surprised that use of GIT_CEILING_DIRECTORIES was not done > until 2021, actually. The reason the configuration variable was > invented for is exactly to avoid discovery processes going upward > and ending up in a repository different from what we mean to work > with.
I didn't know about these historical details. All I know is that I wrote these changes on top of the buggy patch in [1] and confirmed that it failed with a segfault. Thanks for confirming the reason that this works!
[1] https://lore.kernel.org/git/86cd83f65b30aab3233e27b3e5c4f03041e68766.1771903950.git.gitgitgadget@gmail.com/
Thanks, -Stolee