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>
Stephan Beyer committed
Dec 7, 2016 at 22:51 UTC
aeebd98ebe0fbd61f517d9da04f914c37ea0066b
1 file changed
+10
t/t3510-cherry-pick-sequence.sh
+10
@@ -147,6 +147,16 @@ test_expect_success '--abort to cancel single cherry-pick' '
147
git diff-index --exit-code HEAD
148
'
149
150
+test_expect_failure '--abort does not unsafely change HEAD' '
151
+ pristine_detach initial &&
152
+ test_must_fail git cherry-pick picked anotherpick &&
153
+ git reset --hard base &&
154
+ test_must_fail git cherry-pick picked anotherpick &&
155
+ git cherry-pick --abort 2>actual &&
156
+ test_i18ngrep "You seem to have moved HEAD" actual &&
157
+ test_cmp_rev base HEAD
158
+'
159
+
160
test_expect_success 'cherry-pick --abort to cancel multiple revert' '
161
pristine_detach anotherpick &&
162
test_expect_code 1 git revert base..picked &&