зеркало из https://github.com/microsoft/git.git
add tests for rebasing of empty commits
Signed-off-by: Martin von Zweigbergk <martinvonz@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Родитель
5b5e1c7c78
Коммит
00b8be5a4d
|
@ -42,28 +42,4 @@ test_expect_success 'rebase --merge topic branch that was partially merged upstr
|
|||
test_path_is_missing .git/rebase-merge
|
||||
'
|
||||
|
||||
test_expect_success 'rebase ignores empty commit' '
|
||||
git reset --hard A &&
|
||||
git commit --allow-empty -m empty &&
|
||||
test_commit D &&
|
||||
git rebase C &&
|
||||
test "$(git log --format=%s C..)" = "D"
|
||||
'
|
||||
|
||||
test_expect_success 'rebase --keep-empty' '
|
||||
git reset --hard D &&
|
||||
git rebase --keep-empty C &&
|
||||
test "$(git log --format=%s C..)" = "D
|
||||
empty"
|
||||
'
|
||||
|
||||
test_expect_success 'rebase --keep-empty keeps empty even if already in upstream' '
|
||||
git reset --hard A &&
|
||||
git commit --allow-empty -m also-empty &&
|
||||
git rebase --keep-empty D &&
|
||||
test "$(git log --format=%s A..)" = "also-empty
|
||||
D
|
||||
empty"
|
||||
'
|
||||
|
||||
test_done
|
||||
|
|
|
@ -160,4 +160,62 @@ test_run_rebase success -m
|
|||
test_run_rebase success -i
|
||||
test_run_rebase success -p
|
||||
|
||||
# a---b---c---j!
|
||||
# \
|
||||
# d---k!--l
|
||||
#
|
||||
# ! = empty
|
||||
test_expect_success 'setup of linear history for empty commit tests' '
|
||||
git checkout c &&
|
||||
make_empty j &&
|
||||
git checkout d &&
|
||||
make_empty k &&
|
||||
test_commit l
|
||||
'
|
||||
|
||||
test_run_rebase () {
|
||||
result=$1
|
||||
shift
|
||||
test_expect_$result "rebase $* drops empty commit" "
|
||||
reset_rebase &&
|
||||
git rebase $* c l &&
|
||||
test_cmp_rev c HEAD~2 &&
|
||||
test_linear_range 'd l' c..
|
||||
"
|
||||
}
|
||||
test_run_rebase success ''
|
||||
test_run_rebase success -m
|
||||
test_run_rebase success -i
|
||||
test_run_rebase success -p
|
||||
|
||||
test_run_rebase () {
|
||||
result=$1
|
||||
shift
|
||||
test_expect_$result "rebase $* --keep-empty" "
|
||||
reset_rebase &&
|
||||
git rebase $* --keep-empty c l &&
|
||||
test_cmp_rev c HEAD~3 &&
|
||||
test_linear_range 'd k l' c..
|
||||
"
|
||||
}
|
||||
test_run_rebase success ''
|
||||
test_run_rebase failure -m
|
||||
test_run_rebase success -i
|
||||
test_run_rebase failure -p
|
||||
|
||||
test_run_rebase () {
|
||||
result=$1
|
||||
shift
|
||||
test_expect_$result "rebase $* --keep-empty keeps empty even if already in upstream" "
|
||||
reset_rebase &&
|
||||
git rebase $* --keep-empty j l &&
|
||||
test_cmp_rev j HEAD~3 &&
|
||||
test_linear_range 'd k l' j..
|
||||
"
|
||||
}
|
||||
test_run_rebase success ''
|
||||
test_run_rebase failure -m
|
||||
test_run_rebase failure -i
|
||||
test_run_rebase failure -p
|
||||
|
||||
test_done
|
||||
|
|
Загрузка…
Ссылка в новой задаче