Re: [PATCH v3 4/4] stash: honor stash.index in apply, pop modes
- From
- Phillip Wood <phillip.wood123@gmail.com>
- Date
- Sep 29, 2025, 10:01 UTC
- Message-ID
- <b36d2dbf-7cf4-46cd-81bb-b502e0eed380@gmail.com>
- In-Reply-To
- <CALnO6CA9z39rgGd673p-ZMzMOBM_G37YPOs4ysNtPHGGCDVM-A@mail.gmail.com>
On 24/09/2025 21:40, D. Ben Knoble wrote:
Show 22 quoted lines
> On Mon, Sep 22, 2025 at 10:11 AM Phillip Wood <phillip.wood123@gmail.com> 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