git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "D. Ben Knoble" <ben.knoble+github@gmail.com>
To: phillip.wood@dunelm.org.uk
Cc: git@vger.kernel.org, "Junio C Hamano" <gitster@pobox.com>,
	"Glen Choo" <glencbz@gmail.com>,
	"Karthik Nayak" <karthik.188@gmail.com>,
	"John Cai" <johncai86@gmail.com>,
	"Denton Liu" <liu.denton@gmail.com>,
	"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Subject: Re: [PATCH v2 4/4] stash: honor stash.index in apply, pop modes
Date: Tue, 16 Sep 2025 13:07:47 -0400	[thread overview]
Message-ID: <CALnO6CByUNHWFRYBSOpP-uD8moBrm48UW7k0MaGTUtL=bDL6GQ@mail.gmail.com> (raw)
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:
>
> 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!

  reply	other threads:[~2025-09-16 17:08 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-10 18:33 [PATCH 0/9] make stash apply with --index by default D. Ben Knoble
2025-05-10 18:33 ` [PATCH 1/9] t3903: reduce dependencies on previous tests D. Ben Knoble
2025-05-10 18:33 ` [PATCH 2/9] t3905: remove unneeded blank line D. Ben Knoble
2025-05-10 18:33 ` [PATCH 3/9] BreakingChanges: announce stash {apply,pop} will imply --index D. Ben Knoble
2025-05-10 18:33 ` [PATCH 4/9] stash: restore the index by default when breaking changes are enabled D. Ben Knoble
2025-05-10 18:33 ` [PATCH 5/9] t0450: mark stash documentation as a known discrepancy D. Ben Knoble
2025-05-10 18:33 ` [PATCH 6/9] t3903: adjust stash test to account for --[no-]index with breaking changes D. Ben Knoble
2025-05-10 18:33 ` [PATCH 7/9] t3904: adjust stash -p test to account for index states " D. Ben Knoble
2025-05-10 18:33 ` [PATCH 8/9] t3905: adjust stash -u tests for " D. Ben Knoble
2025-05-10 18:33 ` [PATCH 9/9] t3906: adjust stash submodule tests to account " D. Ben Knoble
2025-05-12 12:52 ` [PATCH 0/9] make stash apply with --index by default Junio C Hamano
2025-05-20 14:36 ` D. Ben Knoble
2025-05-20 14:39 ` D. Ben Knoble
2025-09-16  0:37 ` [PATCH v2 0/4] Teach git-stash to use --index from config D. Ben Knoble
2025-09-16  0:37   ` [PATCH v2 1/4] t3903: reduce dependencies on previous tests D. Ben Knoble
2025-09-16  0:37   ` [PATCH v2 2/4] t3905: remove unneeded blank line D. Ben Knoble
2025-09-16  0:37   ` [PATCH v2 3/4] stash: refactor private config globals D. Ben Knoble
2025-09-16  0:37   ` [PATCH v2 4/4] stash: honor stash.index in apply, pop modes D. Ben Knoble
2025-09-16  9:18     ` Phillip Wood
2025-09-16 17:07       ` D. Ben Knoble [this message]
2025-09-16  9:24   ` [PATCH v2 0/4] Teach git-stash to use --index from config Phillip Wood
2025-09-16 17:06     ` D. Ben Knoble
2025-09-16 16:49   ` Junio C Hamano
2025-09-22  1:39   ` [PATCH v3 " D. Ben Knoble
2025-09-22  1:39     ` [PATCH v3 1/4] t3903: reduce dependencies on previous tests D. Ben Knoble
2025-09-22  1:39     ` [PATCH v3 2/4] t3905: remove unneeded blank line D. Ben Knoble
2025-09-22  1:39     ` [PATCH v3 3/4] stash: refactor private config globals D. Ben Knoble
2025-09-22  1:39     ` [PATCH v3 4/4] stash: honor stash.index in apply, pop modes D. Ben Knoble
2025-09-22 14:11       ` Phillip Wood
2025-09-24 20:40         ` D. Ben Knoble
2025-09-29 10:01           ` Phillip Wood
2025-10-06 12:59             ` [PATCH] doc: explain the impact of stash.index on --autostash options D. Ben Knoble
2025-10-09 22:54               ` Kristoffer Haugsbakk
2025-10-11 14:44                 ` D. Ben Knoble
2025-10-11 17:28                   ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CALnO6CByUNHWFRYBSOpP-uD8moBrm48UW7k0MaGTUtL=bDL6GQ@mail.gmail.com' \
    --to=ben.knoble+github@gmail.com \
    --cc=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=glencbz@gmail.com \
    --cc=johncai86@gmail.com \
    --cc=karthik.188@gmail.com \
    --cc=liu.denton@gmail.com \
    --cc=phillip.wood@dunelm.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).