Subject: Re: [PATCH] checkout: add --autostash option for branch switching

From: Phillip Wood <[email-masked]>
Date: Wed, 15 Apr 2026 10:34:39 +0100

On 14/04/2026 21:08, Harald Nordgren wrote:
>>> +test_expect_success 'apply with custom conflict labels' '
>>> +	git init conflict_labels &&
>>> +	(
>>
>> I'm still unclear why we're creating a new repository here. Our test
>> suite is slow enough already without each test spending time creating
>> its own repository. There doesn't seem to be anything here that requires
>> isolating the test in this way.
> 
> Yes, I want this too, but I had some problems to get it to work. Found a
> way now I think, but the cleanup is not 100% trivial (this is the only
> reason to run anything inside a new repo).

Normally the first test would setup some commits with test_commit() that 
creates a tag so you can just use "git reset --hard <tag>" to start your 
test from a known state. Unfortunately setup_stash() does not use 
test_commit() so there are no tags. It would be useful to fix that by 
adding a line that creates a tag so that future test authors do not face 
the same problem.

Thanks

Phillip