Re: [PATCH 0/9] make stash apply with --index by default
- From
D. Ben Knoble <ben.knoble+github@gmail.com>
- Date
- May 20, 2025, 14:36 UTC
- Message-ID
- <CALnO6CA0S_54HjyNDWyTAhfmRFcTsFEMF67yWjMeL526O14aQg@mail.gmail.com>
- In-Reply-To
- <20250510183358.36806-1-ben.knoble+github@gmail.com>
On Sat, May 10, 2025 at 2:34 PM D. Ben Knoble <ben.knoble+github@gmail.com> wrote:
Show 51 quoted lines
>
> Since git-stash's inception, it has defaulted to stashing the index but not
> restoring it. This has caused some confusion: change the default as part of Git
> 3.0 to unstash the index, too.
>
> I ran into this myself a while back and did some digging; it appears that other
> have been bit, too (see references in patch 3). Moreover, when git-stash was
> originally written, defaulting with --index was suggested but not implemented
> before the script merged. So this RFC should bring us back towards "less
> confusing," hopefully.
>
> The series is structured as follows:
>
> Patches 1-2: unrelated prep/style commits noticed while working on tests.
> Patch 3: update Documentation/BreakingChanges.adoc. This seems like a natural
> place to discuss the proposal, so it contains no other changes.
> Patch 4: make it so in builtin/stash.c.
> Patches 5-9: update the impacted tests. Separated out for ease of review. I used
> a style more like "split the test into 2: one with, one without breaking
> changes." In retrospect, the diff might be smaller (and the 2 versions of
> the test easier to compare) if I used "test_has_prereq" in the tests… but at
> the cost of making the tests harder to follow. Thoughts?
>
> D. Ben Knoble (9):
> t3903: reduce dependencies on previous tests
> t3905: remove unneeded blank line
> BreakingChanges: announce stash {apply,pop} will imply --index
> stash: restore the index by default when breaking changes are enabled
> t0450: mark stash documentation as a known discrepancy
> t3903: adjust stash test to account for --[no-]index with breaking
> changes
> t3904: adjust stash -p test to account for index states with breaking
> changes
> t3905: adjust stash -u tests for breaking changes
> t3906: adjust stash submodule tests to account for breaking changes
>
> Documentation/BreakingChanges.adoc | 11 ++
> Documentation/git-stash.adoc | 6 ++
> builtin/stash.c | 38 +++++++
> t/lib-submodule-update.sh | 24 ++++-
> t/t0450/adoc-help-mismatches | 1 +
> t/t3903-stash.sh | 161 +++++++++++++++++++++++++++--
> t/t3904-stash-patch.sh | 14 ++-
> t/t3905-stash-include-untracked.sh | 40 ++++++-
> 8 files changed, 276 insertions(+), 19 deletions(-)
>
>
> base-commit: 1ee85f0e215f22b0878d0ad4b2445d12bbb63887
> --
> 2.48.1
>