]> Pileus Git - ~andy/git/commitdiff
t3502, t3510: clarify cherry-pick -m failure
authorRamkumar Ramachandra <artagnon@gmail.com>
Wed, 14 Dec 2011 16:54:33 +0000 (22:24 +0530)
committerJunio C Hamano <gitster@pobox.com>
Thu, 15 Dec 2011 21:20:19 +0000 (13:20 -0800)
The "cherry-pick persists opts correctly" test in t3510
(cherry-pick-sequence) can cause some confusion, because the command
actually has two points of failure:

1. "-m 1" is specified on the command-line despite the base commit
   "initial" not being a merge-commit.
2. The revision range indicates that there will be a conflict that
   needs to be resolved.

Although the former error is trapped, and cherry-pick die()s with the
exit status 128, the reader may be distracted by the latter.  Fix this
by changing the revision range to something that wouldn't cause a
conflict.  Additionally, explicitly check the exit code in
"cherry-pick a non-merge with -m should fail" in t3502
(cherry-pick-merge) to reassure the reader that this failure has
nothing to do with the sequencer itself.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t3502-cherry-pick-merge.sh
t/t3510-cherry-pick-sequence.sh

index 0ab52da902c8d602e9c4d64660aa4a7e8e35544f..e37547f41a21ebda150aad6797012c9df3742382 100755 (executable)
@@ -35,7 +35,7 @@ test_expect_success 'cherry-pick a non-merge with -m should fail' '
 
        git reset --hard &&
        git checkout a^0 &&
-       test_must_fail git cherry-pick -m 1 b &&
+       test_expect_code 128 git cherry-pick -m 1 b &&
        git diff --exit-code a --
 
 '
index f13a194243271cfd6f5c352cadb8f4695c78ad66..97f371070011e2023552d9fe941dc0a406f6d09f 100755 (executable)
@@ -67,7 +67,7 @@ test_expect_success 'cherry-pick mid-cherry-pick-sequence' '
 
 test_expect_success 'cherry-pick persists opts correctly' '
        pristine_detach initial &&
-       test_expect_code 128 git cherry-pick -s -m 1 --strategy=recursive -X patience -X ours base..anotherpick &&
+       test_expect_code 128 git cherry-pick -s -m 1 --strategy=recursive -X patience -X ours initial..anotherpick &&
        test_path_is_dir .git/sequencer &&
        test_path_is_file .git/sequencer/head &&
        test_path_is_file .git/sequencer/todo &&