[PATCH v4 3/5] t3903: test failed "stash apply --index"
- From
D. Ben Knoble <ben.knoble@gmail.com>
- Date
- Sep 29, 2026, 12:18 UTC
- Message-ID
- <7b0b317ce061d672ef143b1628a2d0097a878c87.1790684309.git.ben.knoble@gmail.com>
- In-Reply-To
- <cover.1790684309.git.ben.knoble@gmail.com>
The next commit will refactor index handling for applied stashes, so let's make sure we cover conflicted index merging, too.
Helped-by: Phillip Wood <phillip.wood@dunelm.org.uk> Signed-off-by: D. Ben Knoble <ben.knoble@gmail.com> --- t/t3903-stash.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
diff --git a/t/t3903-stash.sh b/t/t3903-stash.sh index 721158606f..70af58e161 100755 --- a/t/t3903-stash.sh +++ b/t/t3903-stash.sh @@ -374,6 +374,27 @@ setup_stash() { test_cmp expect actual ' +test_expect_success 'stash apply --index leaves everything untouched on failure' ' + git reset --hard && + echo test >other-file && + git add other-file && + git stash && + echo unrelated >file && + echo unrelated >another-file && + git add another-file && + echo conflict >other-file && + git add other-file && + git diff-files -p >expect && + git diff-index --cached HEAD >expect-index && + + test_must_fail git stash apply --index 2>err && + test_grep "conflicts in index. Try without --index" err && + git diff-files -p >actual && + test_cmp expect actual && + git diff-index --cached HEAD >actual-index && + test_cmp expect-index actual-index +' + test_expect_success 'stash -k' ' echo bar3 >file && echo bar4 >file2 &&
-- 2.56.0.rc1.315.gc6ed9934b7.dirty