Skip to content

Commit 2542840

Browse files
Martin von Zweigbergkgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 2b5ba7b commit 2542840

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

t/t3401-rebase-partial.sh

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,23 @@ test_expect_success 'rebase ignores empty commit' '
4747
git commit --allow-empty -m empty &&
4848
test_commit D &&
4949
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"
5167
'
5268

5369
test_done

0 commit comments

Comments
 (0)