summaryrefslogtreecommitdiff
path: root/t/t7600-merge.sh
diff options
context:
space:
mode:
authorMichael J Gruber <git@grubix.eu>2017-08-23 12:10:45 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-08-23 17:35:02 (GMT)
commit9d89b35526b54c3ba33371b184a1ba6e30f8f46f (patch)
treec8ee29a878b32625273316edf9c84bbfce7c19cf /t/t7600-merge.sh
parent8e6a6bb36037da87ac98da280459269168b9f525 (diff)
downloadgit-9d89b35526b54c3ba33371b184a1ba6e30f8f46f.zip
git-9d89b35526b54c3ba33371b184a1ba6e30f8f46f.tar.gz
git-9d89b35526b54c3ba33371b184a1ba6e30f8f46f.tar.bz2
merge: save merge state earlier
If the `git merge` process is killed while waiting for the editor to finish, the merge state is lost but the prepared merge msg and tree is kept. So, a subsequent `git commit` creates a squashed merge even when the user asked for proper merge commit originally. Demonstrate the problem with a test crafted after the in t7502. The test requires EXECKEEPSPID (thus does not run under MINGW). Save the merge state earlier (in the non-squash case) so that it does not get lost. This makes the test pass. Reported-by: hIpPy <hippy2981@gmail.com> Signed-off-by: Michael J Gruber <git@grubix.eu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t7600-merge.sh')
-rwxr-xr-xt/t7600-merge.sh15
1 files changed, 15 insertions, 0 deletions
diff --git a/t/t7600-merge.sh b/t/t7600-merge.sh
index 2ebda50..80194b7 100755
--- a/t/t7600-merge.sh
+++ b/t/t7600-merge.sh
@@ -774,4 +774,19 @@ test_expect_success 'merge can be completed with --continue' '
verify_parents $c0 $c1
'
+write_script .git/FAKE_EDITOR <<EOF
+# kill -TERM command added below.
+EOF
+
+test_expect_success EXECKEEPSPID 'killed merge can be completed with --continue' '
+ git reset --hard c0 &&
+ ! "$SHELL_PATH" -c '\''
+ echo kill -TERM $$ >> .git/FAKE_EDITOR
+ GIT_EDITOR=.git/FAKE_EDITOR
+ export GIT_EDITOR
+ exec git merge --no-ff --edit c1'\'' &&
+ git merge --continue &&
+ verify_parents $c0 $c1
+'
+
test_done