[PATCH v2 3/4] t: test failed "stash apply --index"
- From
D. Ben Knoble <ben.knoble@gmail.com>
- Date
- Sep 23, 2026, 12:58 UTC
- Message-ID
- <5bd4b78cace8ba8c8887c78f739bde3513dfda28.1790168285.git.ben.knoble@gmail.com>
- In-Reply-To
- <cover.1790168285.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.
Signed-off-by: D. Ben Knoble <ben.knoble@gmail.com> --- t/t3903-stash.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
diff --git a/t/t3903-stash.sh b/t/t3903-stash.sh index 721158606f..3958ab3c8d 100755 --- a/t/t3903-stash.sh +++ b/t/t3903-stash.sh @@ -374,6 +374,24 @@ 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 && + git diff-files >expect && + + echo conflict >other-file && + git add other-file && + test_must_fail git stash apply --index 2>err && + test_grep "conflicts in index. Try without --index" err && + git diff-files >actual && + test_cmp expect actual +' + test_expect_success 'stash -k' ' echo bar3 >file && echo bar4 >file2 &&
-- 2.56.0.rc1.315.gc6ed9934b7.dirty