add tests for 'git rebase --keep-empty'

Add test cases for 'git rebase --keep-empty' with and without an "empty" commit already in upstream. The empty commit that is about to be rebased should be kept in both cases. Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Martin von Zweigbergk committed Aug 9, 2012 at 08:39 UTC 25428403448602a19116dc271f000a3735c6779b
1 file changed +17 -1
t/t3401-rebase-partial.sh
+17 -1
@@ -47,7 +47,23 @@ test_expect_success 'rebase ignores empty commit' '
47 git commit --allow-empty -m empty &&
48 test_commit D &&
49 git rebase C &&
50 - test $(git log --format=%s C..) = "D"
50 + test "$(git log --format=%s C..)" = "D"
51 +'
52 +
53 +test_expect_success 'rebase --keep-empty' '
54 + git reset --hard D &&
55 + git rebase --keep-empty C &&
56 + test "$(git log --format=%s C..)" = "D
57 +empty"
58 +'
59 +
60 +test_expect_success 'rebase --keep-empty keeps empty even if already in upstream' '
61 + git reset --hard A &&
62 + git commit --allow-empty -m also-empty &&
63 + git rebase --keep-empty D &&
64 + test "$(git log --format=%s A..)" = "also-empty
65 +D
66 +empty"
67 '
68
69 test_done