Subject: Re: [PATCH v15 3/5] sequencer: teach autostash apply to take optional conflict marker labels

From: Phillip Wood <[email-masked]>
Date: Tue, 28 Apr 2026 10:33:38 +0100

Hi Harald

On 24/04/2026 22:10, Harald Nordgren via GitGitGadget wrote:
> From: Harald Nordgren <[email-masked]>
> 
> Add label_ours, label_theirs, label_base, and stash_msg parameters to
> apply_autostash_ref() and the autostash apply machinery so callers can
> pass custom conflict marker labels through to
> "git stash apply --label-ours/--label-theirs/--label-base", as well as
> a custom stash message for "git stash store -m".

I said before that I was confused as to why we need to pass a message 
when all we're doing is saving an existing stash and the stash already 
has the message we want. As that didn't get any response I've had a more 
detailed look. The message here is used in the reflog (which is what 
"git stash list" shows) and it appears that the reason for passing a 
message when storing the stash is because "git stash store" is not smart 
enough to reuse the subject from the stash commit message by default. It 
would be nice to improve that rather than having to pass a message here. 
"git rebase --autostash" and "git merge --autostash" do not have the 
luxury of calling "git stash store" from the same process as "git stash 
create" and so to improve the autostash message for those commands we'd 
need to generate it twice which seems like an unnecessary complication.

One problem with that approach in the context of this series is that the 
stash commit message begins "On <branch we're switching from>: " rather 
than "On <branch we're switching to>: " but that means this commit is 
just hiding the fact that commit message is wrong when we create the stash.

It may well be that fixing all that turns out to be a lot of work as it 
would mean modifying do_create_stash() to allow the branch name to be 
overridden and modifying store_stash() to use the commit subject as the 
reflog message in which case we should leave that for a future series.

Thanks

Phillip