Subject: Re: [PATCH v14 0/5] checkout: 'autostash' for branch switching

From: Phillip Wood <[email-masked]>
Date: Fri, 24 Apr 2026 16:52:50 +0100

Hi Harald

On 15/04/2026 17:24, Harald Nordgren via GitGitGadget wrote:
> Simplifying the tests in t/t3903-stash.sh according to Phillip Wood's
> comment. I believe everything sound be fixed now or responded to.

This is better than the last cover letter, but it would be helpful to 
describe the changes you have made rather than just say your responding 
to a reviewers comment. Junio has given some suggestions for 
coverletters to take inspiration from.

Also when you reply to messages can you try and keep the subject line 
please - nearly all the responses from you have the subject

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

regardless of the message they're actually replying to. That makes it 
hard to see which message you're replying to.

I've left some comments on patch 5, it is definitely looking better but 
there are still a couple of things that need fixing.

Thanks

Phillip

> Also rebasing against upstream.
> 
> Harald Nordgren (5):
>    stash: add --label-ours, --label-theirs, --label-base for apply
>    sequencer: allow create_autostash to run silently
>    sequencer: teach autostash apply to take optional conflict marker
>      labels
>    checkout: rollback lock on early returns in merge_working_tree
>    checkout -m: autostash when switching branches
> 
>   Documentation/git-checkout.adoc |  58 ++++-----
>   Documentation/git-stash.adoc    |  11 +-
>   Documentation/git-switch.adoc   |  33 ++---
>   builtin/checkout.c              | 149 +++++++++++------------
>   builtin/commit.c                |   3 +-
>   builtin/merge.c                 |  15 ++-
>   builtin/stash.c                 |  28 +++--
>   sequencer.c                     |  73 ++++++++---
>   sequencer.h                     |   7 +-
>   t/t3420-rebase-autostash.sh     |  24 +++-
>   t/t3903-stash.sh                |  24 ++++
>   t/t7201-co.sh                   | 208 ++++++++++++++++++++++++++++++++
>   t/t7600-merge.sh                |   2 +-
>   xdiff-interface.c               |  12 ++
>   xdiff-interface.h               |   1 +
>   xdiff/xmerge.c                  |   6 +-
>   16 files changed, 483 insertions(+), 171 deletions(-)
> 
> 
> base-commit: 9f223ef1c026d91c7ac68cc0211bde255dda6199
> Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-2234%2FHaraldNordgren%2Fcheckout_autostash-v14
> Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-2234/HaraldNordgren/checkout_autostash-v14
> Pull-Request: https://github.com/git/git/pull/2234
> 
> Range-diff vs v13:
> 
>   1:  43bfdf2136 ! 1:  e18c25599a stash: add --label-ours, --label-theirs, --label-base for apply
>       @@ builtin/stash.c: static int branch_stash(int argc, const char **argv, const char
>         
>        
>         ## t/t3903-stash.sh ##
>       -@@ t/t3903-stash.sh: test_expect_success 'restore untracked files even when we hit conflicts' '
>       - 	)
>       +@@ t/t3903-stash.sh: setup_stash() {
>       + 	git add other-file &&
>       + 	test_tick &&
>       + 	git commit -m initial &&
>       ++	git tag initial &&
>       + 	echo 2 >file &&
>       + 	git add file &&
>       + 	echo 3 >file &&
>       +@@ t/t3903-stash.sh: test_expect_success 'stash.index=false overridden by --index' '
>       + 	test_cmp expect file
>         '
>         
>        +test_expect_success 'apply with custom conflict labels' '
>       -+	test_when_finished "git reset --hard && git stash drop" &&
>       -+	git reset --hard &&
>       ++	git reset --hard initial &&
>        +	test_commit label-base conflict-file base-content &&
>        +	echo stashed >conflict-file &&
>        +	git stash push -m "stashed" &&
>       @@ t/t3903-stash.sh: test_expect_success 'restore untracked files even when we hit
>        +'
>        +
>        +test_expect_success 'apply with empty conflict labels' '
>       -+	test_when_finished "git reset --hard && git stash drop" &&
>       -+	git reset --hard &&
>       ++	git reset --hard initial &&
>        +	test_commit empty-label-base conflict-file base-content &&
>        +	echo stashed >conflict-file &&
>        +	git stash push -m "stashed" &&
>       @@ t/t3903-stash.sh: test_expect_success 'restore untracked files even when we hit
>        +	test_grep "^>>>>>>>$" conflict-file
>        +'
>        +
>       - test_expect_success 'stash create reports a locked index' '
>       - 	test_when_finished "rm -rf repo" &&
>       - 	git init repo &&
>       + test_done
>        
>         ## xdiff/xmerge.c ##
>        @@ xdiff/xmerge.c: static int fill_conflict_hunk(xdfenv_t *xe1, const char *name1,
>   2:  7f3c32f5e9 = 2:  ce29b10264 sequencer: allow create_autostash to run silently
>   3:  b279d1dac8 = 3:  73051d1762 sequencer: teach autostash apply to take optional conflict marker labels
>   4:  04869314ec = 4:  191058d8e3 checkout: rollback lock on early returns in merge_working_tree
>   5:  4b3c6025ac = 5:  86f33df1eb checkout -m: autostash when switching branches
>