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
diff options
context:
space:
mode:
authorPhillip Wood <phillip.wood@dunelm.org.uk>2019-12-06 19:06:08 +0300
committerJunio C Hamano <gitster@pobox.com>2019-12-06 20:32:01 +0300
commitf028d661c74f29de0e26494e6c9fbcf186b0d4ae (patch)
tree144278d621733bd2236c6bf0e7c9bd8ecac151ce /t/t3507-cherry-pick-conflict.sh
parent5b7a64df40bec755b0d9ef477764e45ba72abf7b (diff)
cherry-pick: check commit error messages
We disallow partial commits and amending when CHERRY_PICK_HEAD exists. Add a couple of tests to check the error message printed in each case before we refactor the code responsible for this. Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t3507-cherry-pick-conflict.sh')
-rwxr-xr-xt/t3507-cherry-pick-conflict.sh23
1 files changed, 23 insertions, 0 deletions
diff --git a/t/t3507-cherry-pick-conflict.sh b/t/t3507-cherry-pick-conflict.sh
index 9b9b4ca8d4..c9715bf674 100755
--- a/t/t3507-cherry-pick-conflict.sh
+++ b/t/t3507-cherry-pick-conflict.sh
@@ -161,6 +161,29 @@ test_expect_success 'successful commit clears CHERRY_PICK_HEAD' '
test_must_fail git rev-parse --verify CHERRY_PICK_HEAD
'
+
+test_expect_success 'partial commit of cherry-pick fails' '
+ pristine_detach initial &&
+
+ test_must_fail git cherry-pick picked &&
+ echo resolved >foo &&
+ git add foo &&
+ test_must_fail git commit foo 2>err &&
+
+ test_i18ngrep "cannot do a partial commit during a cherry-pick." err
+'
+
+test_expect_success 'commit --amend of cherry-pick fails' '
+ pristine_detach initial &&
+
+ test_must_fail git cherry-pick picked &&
+ echo resolved >foo &&
+ git add foo &&
+ test_must_fail git commit --amend 2>err &&
+
+ test_i18ngrep "in the middle of a cherry-pick -- cannot amend." err
+'
+
test_expect_success 'successful final commit clears cherry-pick state' '
pristine_detach initial &&