3 test_description='git rebase of commits that start or become empty'
7 test_expect_success 'setup test repository' '
8 test_write_lines 1 2 3 4 5 6 7 8 9 10 >numbers &&
9 test_write_lines A B C D E F G H I J >letters &&
10 git add numbers letters &&
13 git branch upstream &&
14 git branch localmods &&
16 git checkout upstream &&
17 test_write_lines A B C D E >letters &&
21 test_write_lines 1 2 3 4 five 6 7 8 9 ten >numbers &&
25 git checkout localmods &&
26 test_write_lines 1 2 3 4 five 6 7 8 9 10 >numbers &&
30 git commit --allow-empty -m D &&
32 test_write_lines A B C D E >letters &&
34 git commit -m "Five letters ought to be enough for anybody"
37 test_expect_failure 'rebase (am-backend) with a variety of empty commits' '
38 test_when_finished "git rebase --abort" &&
39 git checkout -B testing localmods &&
40 # rebase (--am) should not drop commits that start empty
41 git rebase upstream &&
43 test_write_lines D C B A >expect &&
44 git log --format=%s >actual &&
45 test_cmp expect actual
48 test_expect_failure 'rebase --merge with a variety of empty commits' '
49 test_when_finished "git rebase --abort" &&
50 git checkout -B testing localmods &&
51 # rebase --merge should not halt on the commit that becomes empty
52 git rebase --merge upstream &&
54 test_write_lines D C B A >expect &&
55 git log --format=%s >actual &&
56 test_cmp expect actual
59 test_expect_success 'rebase --interactive with a variety of empty commits' '
60 git checkout -B testing localmods &&
61 test_must_fail git rebase --interactive upstream &&
65 test_write_lines D C B A >expect &&
66 git log --format=%s >actual &&
67 test_cmp expect actual