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 [off-list ref]
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 9bc99fa252..11942d875b 100755
--- a/t/t3903-stash.sh
+++ b/t/t3903-stash.sh
@@ -395,6 +395,27 @@ setup_stash() {
test_cmp expect file
'
+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