[PATCH v3 3/5] t3903: test stash --index merges
From: D. Ben Knoble <hidden>
Date: 2026-09-26 12:17:40
Subsystem:
the rest · Maintainer:
Linus Torvalds
A future commit will refactor index handling for applied stashes, and we need to take care to get the order of trees right when merging. Add a test that covers this case. Suggested-by: Phillip Wood <redacted> Signed-off-by: D. Ben Knoble <redacted> --- t/t3903-stash.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
diff --git a/t/t3903-stash.sh b/t/t3903-stash.sh
index 721158606f..9bc99fa252 100755
--- a/t/t3903-stash.sh
+++ b/t/t3903-stash.sh@@ -374,6 +374,27 @@ setup_stash() { test_cmp expect actual ' +# the later "stash -k" test is not expecting us to muck with file so much, so +# reset when finished +test_expect_success 'stash apply --index merges the correct trees' ' + head=$(git rev-parse HEAD) && + test_when_finished "git reset --hard $head" && + test_write_lines A B C >file && + git commit -m setup file && + test_write_lines A B staged >file && + git add file && + test_write_lines A B unstaged >file && + git stash && + test_write_lines committed B C >file && + git commit -m to-be-merged file && + git stash pop --index && + git show :file >actual && + test_write_lines committed B staged >expect && + test_cmp expect actual && + test_write_lines committed B unstaged >expect && + test_cmp expect file +' + test_expect_success 'stash -k' ' echo bar3 >file && echo bar4 >file2 &&
--
2.56.0.rc1.315.gc6ed9934b7.dirty