Subject: Re: [PATCH v3 4/4] stash: honor stash.index in apply, pop modes

From: Phillip Wood <[email-masked]>
Date: Mon, 29 Sep 2025 11:01:04 +0100

On 24/09/2025 21:40, D. Ben Knoble wrote:
> On Mon, Sep 22, 2025 at 10:11 AM Phillip Wood <[email-masked]> wrote:
>>
>> Hi Ben
>>
>> On 22/09/2025 02:39, D. Ben Knoble wrote:
>>> With stash.index=true, git-stash(1) command now tries to reinstate the
>>> index by default in the "apply" and "pop" modes. Not doing so creates a
>>> common trap [1], [2]: "git stash apply" is not the reverse of "git stash
>>> push" because carefully staged indices are lost and have to be manually
>>> recreated. OTOH, this mode is not always desirable and may create more
>>> conflicts when applying stashes. As usual, "--no-index" will disable
>>> this behavior if you set "stash.index".
>>
>> Thanks for updating the tests, they look good. As I said before I don't
>> have a strong opinion about this change but I certainly don't object to
>> it. I think this change will also affect the behavior of "git
>> merge/pull/rebase --autostash" which we should maybe call out in the
>> commit message. I don't think that change in behavior is a problem as it
>> is probably what the user would expect when they set this config.
> 
> Agreed, I hadn't considered that here. Should we also update the docs,
> do you think?

Good idea, we should certainly mention it in the documentation for the 
new config setting, I'm not sure whether it is worth mentioning it in 
the "--autostash" documentation for the individual commands.

Thanks

Phillip