summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorElijah Newren <newren@gmail.com>2022-07-23 01:53:15 (GMT)
committerJunio C Hamano <gitster@pobox.com>2022-07-23 04:45:23 (GMT)
commit1369f1475b998b0022f9bdf3a084ef6e590800aa (patch)
tree5f3a52677ecca8fa030cf3c09a5c156b2da03717 /t
parent8f240b8bbb63591f15c10e43debaf564e63a66bd (diff)
downloadgit-1369f1475b998b0022f9bdf3a084ef6e590800aa.zip
git-1369f1475b998b0022f9bdf3a084ef6e590800aa.tar.gz
git-1369f1475b998b0022f9bdf3a084ef6e590800aa.tar.bz2
merge: fix save_state() to work when there are stat-dirty files
When there are stat-dirty files, but no files are modified, `git stash create` exits with unsuccessful status. This causes merge to fail. Copy some code from sequencer.c's create_autostash to refresh the index first to avoid this problem. Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-xt/t6424-merge-unrelated-index-changes.sh11
1 files changed, 11 insertions, 0 deletions
diff --git a/t/t6424-merge-unrelated-index-changes.sh b/t/t6424-merge-unrelated-index-changes.sh
index 615061c..2c83210 100755
--- a/t/t6424-merge-unrelated-index-changes.sh
+++ b/t/t6424-merge-unrelated-index-changes.sh
@@ -275,6 +275,17 @@ test_expect_success 'subtree' '
test_path_is_missing .git/MERGE_HEAD
'
+test_expect_success 'avoid failure due to stat-dirty files' '
+ git reset --hard &&
+ git checkout B^0 &&
+
+ # Make "a" be stat-dirty
+ test-tool chmtime =+1 a &&
+
+ # stat-dirty file should not prevent stash creation in builtin/merge.c
+ git merge -s resolve -s recursive D^0
+'
+
test_expect_success 'with multiple strategies, recursive or ort failure do not early abort' '
git reset --hard &&
git checkout B^0 &&