git-cherry-pick: Add test to validate new options
Since we've added the --allow-empty and --keep-redundant-commits options to git cherry-pick we should also add a test to ensure that its working properly. Signed-off-by: Neil Horman <nhorman@tuxdriver.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Neil Horman committed
Apr 20, 2012 at 10:36 UTC
bedfe86ce6ccee90e2cbecbf8d72e06219a2768a
1 file changed
+24
-1
t/t3505-cherry-pick-empty.sh
+24
-1
@@ -18,7 +18,12 @@ test_expect_success setup '
18
echo third >> file1 &&
19
git add file1 &&
20
test_tick &&
21
- git commit --allow-empty-message -m ""
21
+ git commit --allow-empty-message -m "" &&
22
+
23
+ git checkout master &&
24
+ git checkout -b empty-branch2 &&
25
+ test_tick &&
26
+ git commit --allow-empty -m "empty"
27
28
'
29
@@ -48,4 +53,22 @@ test_expect_success 'index lockfile was removed' '
53
54
'
55
56
+test_expect_success 'cherry pick an empty non-ff commit without --allow-empty' '
57
+ git checkout master &&
58
+ echo fourth >>file2 &&
59
+ git add file2 &&
60
+ git commit -m "fourth" &&
61
+ test_must_fail git cherry-pick empty-branch2
62
+'
63
+
64
+test_expect_success 'cherry pick an empty non-ff commit with --allow-empty' '
65
+ git checkout master &&
66
+ git cherry-pick --allow-empty empty-branch2
67
+'
68
+
69
+test_expect_success 'cherry pick with --keep-redundant-commits' '
70
+ git checkout master &&
71
+ git cherry-pick --keep-redundant-commits HEAD^
72
+'
73
+
74
test_done