summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Stephan Beyer <s-beyer@gmx.net>2016-12-07 22:51:31 +0100
committerLibravatar Junio C Hamano <gitster@pobox.com>2016-12-09 14:50:45 -0800
commitaeebd98ebe0fbd61f517d9da04f914c37ea0066b (patch)
tree252280ac64e87a433598435e2878cf426f163460
parentam: change safe_to_abort()'s not rewinding error into a warning (diff)
downloadtgif-aeebd98ebe0fbd61f517d9da04f914c37ea0066b.tar.xz
t3510: test that cherry-pick --abort does not unsafely change HEAD
Signed-off-by: Stephan Beyer <s-beyer@gmx.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rwxr-xr-xt/t3510-cherry-pick-sequence.sh10
1 files changed, 10 insertions, 0 deletions
diff --git a/t/t3510-cherry-pick-sequence.sh b/t/t3510-cherry-pick-sequence.sh
index 7b7a89dbd5..efcd4fc485 100755
--- a/t/t3510-cherry-pick-sequence.sh
+++ b/t/t3510-cherry-pick-sequence.sh
@@ -147,6 +147,16 @@ test_expect_success '--abort to cancel single cherry-pick' '
git diff-index --exit-code HEAD
'
+test_expect_failure '--abort does not unsafely change HEAD' '
+ pristine_detach initial &&
+ test_must_fail git cherry-pick picked anotherpick &&
+ git reset --hard base &&
+ test_must_fail git cherry-pick picked anotherpick &&
+ git cherry-pick --abort 2>actual &&
+ test_i18ngrep "You seem to have moved HEAD" actual &&
+ test_cmp_rev base HEAD
+'
+
test_expect_success 'cherry-pick --abort to cancel multiple revert' '
pristine_detach anotherpick &&
test_expect_code 1 git revert base..picked &&