Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2021-08-04 23:28:54 +0300
committerJunio C Hamano <gitster@pobox.com>2021-08-04 23:28:54 +0300
commit5fef3b15dbf609bdb13352d0eb716cd79c8ff017 (patch)
tree5be77acecb89de7a756c632ac2c1dd8fde4514a9 /t
parent1a6fb019d6c09f5e7e2b76fab2a6ad50a8506461 (diff)
parente082631e51ebe2c7ee6756a3b45d10732a6480df (diff)
Merge branch 'pb/merge-autostash-more'
The local changes stashed by "git merge --autostash" were lost when the merge failed in certain ways, which has been corrected. * pb/merge-autostash-more: merge: apply autostash if merge strategy fails merge: apply autostash if fast-forward fails Documentation: define 'MERGE_AUTOSTASH' merge: add missing word "strategy" to a message
Diffstat (limited to 't')
-rwxr-xr-xt/t7600-merge.sh19
1 files changed, 19 insertions, 0 deletions
diff --git a/t/t7600-merge.sh b/t/t7600-merge.sh
index 1cbc9715a8..2ef39d3088 100755
--- a/t/t7600-merge.sh
+++ b/t/t7600-merge.sh
@@ -122,6 +122,8 @@ test_expect_success 'setup' '
c0=$(git rev-parse HEAD) &&
cp file.1 file &&
git add file &&
+ cp file.1 other &&
+ git add other &&
test_tick &&
git commit -m "commit 1" &&
git tag c1 &&
@@ -711,6 +713,15 @@ test_expect_success 'fast-forward merge with --autostash' '
test_cmp result.1-5 file
'
+test_expect_success 'failed fast-forward merge with --autostash' '
+ git reset --hard c0 &&
+ git merge-file file file.orig file.5 &&
+ cp file.5 other &&
+ test_must_fail git merge --autostash c1 2>err &&
+ test_i18ngrep "Applied autostash." err &&
+ test_cmp file.5 file
+'
+
test_expect_success 'octopus merge with --autostash' '
git reset --hard c1 &&
git merge-file file file.orig file.3 &&
@@ -721,6 +732,14 @@ test_expect_success 'octopus merge with --autostash' '
test_cmp result.1-3-5-9 file
'
+test_expect_success 'failed merge (exit 2) with --autostash' '
+ git reset --hard c1 &&
+ git merge-file file file.orig file.5 &&
+ test_must_fail git merge -s recursive --autostash c2 c3 2>err &&
+ test_i18ngrep "Applied autostash." err &&
+ test_cmp result.1-5 file
+'
+
test_expect_success 'conflicted merge with --autostash, --abort restores stash' '
git reset --hard c3 &&
cp file.1 file &&