Skip to content

Commit bedfe86

Browse files
nhormangitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent b27cfb0 commit bedfe86

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

t/t3505-cherry-pick-empty.sh

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,12 @@ test_expect_success setup '
1818
echo third >> file1 &&
1919
git add file1 &&
2020
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"
2227
2328
'
2429

@@ -48,4 +53,22 @@ test_expect_success 'index lockfile was removed' '
4853
4954
'
5055

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+
5174
test_done

0 commit comments

Comments
 (0)