fast-export: do not export negative refs
[git/dscho.git] / t / t3505-cherry-pick-empty.sh
blob92f00cdf84993da995f074efa12344c26b627d67
1 #!/bin/sh
3 test_description='test cherry-picking an empty commit'
5 . ./test-lib.sh
7 test_expect_success setup '
9 echo first > file1 &&
10 git add file1 &&
11 test_tick &&
12 git commit -m "first" &&
14 git checkout -b empty-branch &&
15 test_tick &&
16 git commit --allow-empty -m "empty" &&
18 echo third >> file1 &&
19 git add file1 &&
20 test_tick &&
21 git commit --allow-empty-message -m "" &&
23 git checkout master &&
24 git checkout -b empty-branch2 &&
25 test_tick &&
26 git commit --allow-empty -m "empty"
30 test_expect_success 'cherry-pick an empty commit' '
31 git checkout master && {
32 git cherry-pick empty-branch^
33 test "$?" = 1
37 test_expect_success 'index lockfile was removed' '
39 test ! -f .git/index.lock
43 test_expect_success 'cherry-pick a commit with an empty message' '
44 git checkout master && {
45 git cherry-pick empty-branch
46 test "$?" = 1
50 test_expect_success 'index lockfile was removed' '
52 test ! -f .git/index.lock
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
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
69 test_expect_success 'cherry pick with --keep-redundant-commits' '
70 git checkout master &&
71 git cherry-pick --keep-redundant-commits HEAD^
74 test_done