Re: [PATCH v2 4/4] stash: honor stash.index in apply, pop modes
- From
D. Ben Knoble <ben.knoble+github@gmail.com>
- Date
- Sep 16, 2025, 17:07 UTC
- Message-ID
- <CALnO6CByUNHWFRYBSOpP-uD8moBrm48UW7k0MaGTUtL=bDL6GQ@mail.gmail.com>
- In-Reply-To
- <25836bc2-db3a-4761-b13d-c587728f4c3c@gmail.com>
On Tue, Sep 16, 2025 at 5:18 AM Phillip Wood <phillip.wood123@gmail.com> wrote:
Show 21 quoted lines
> > Hi Ben > > On 16/09/2025 01:37, 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". > > I don't have a strong opinion either way on the new config setting but I > do think we should rationalize the new tests. Assuming we already have > good coverage for "git stash pop --index" then all we need to do is > check that "git -c stash.index=true stash pop", "git -c stash.index=true > stash pop --no-index" and "git -c stash.index=false stash pop --index". > We don't need an exhaustive list of tests that check the config setting > in scenarios like "create twos stashes, drop the second one and apply > the first". Tests like that add no new coverage for the changes in this > patch and slow the test suite down.
Ah, yep. That's much saner.
I started from a "git reset @{u}" of the original series, so it was "cheaper" to keep that copy-pasta. But I much prefer your idea. Thanks!