From: Junio C Hamano Date: Mon, 4 Jun 2018 12:39:50 +0000 (+0900) Subject: Merge branch 'bc/t3430-fixup' X-Git-Tag: v2.18.0-rc1~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e66e8f9be8af90671b85a758b62610bd1162de2d;p=thirdparty%2Fgit.git Merge branch 'bc/t3430-fixup' Test fix. * bc/t3430-fixup: t3430: test clean-up --- e66e8f9be8af90671b85a758b62610bd1162de2d diff --cc t/t3430-rebase-merges.sh index 2608e5483d,9fc4648ff8..78f7c99580 --- a/t/t3430-rebase-merges.sh +++ b/t/t3430-rebase-merges.sh @@@ -242,81 -241,8 +241,80 @@@ test_expect_success 'refuse to merge an test_cmp_rev HEAD $before ' +test_expect_success 'root commits' ' + git checkout --orphan unrelated && + (GIT_AUTHOR_NAME="Parsnip" GIT_AUTHOR_EMAIL="root@example.com" \ + test_commit second-root) && + test_commit third-root && + cat >script-from-scratch <<-\EOF && + pick third-root + label first-branch + reset [new root] + pick second-root + merge first-branch # Merge the 3rd root + EOF + test_config sequence.editor \""$PWD"/replace-editor.sh\" && + test_tick && + git rebase -i --force --root -r && + test "Parsnip" = "$(git show -s --format=%an HEAD^)" && + test $(git rev-parse second-root^0) != $(git rev-parse HEAD^) && + test $(git rev-parse second-root:second-root.t) = \ + $(git rev-parse HEAD^:second-root.t) && + test_cmp_graph HEAD <<-\EOF && + * Merge the 3rd root + |\ + | * third-root + * second-root + EOF + + : fast forward if possible && + before="$(git rev-parse --verify HEAD)" && + test_might_fail git config --unset sequence.editor && + test_tick && + git rebase -i --root -r && + test_cmp_rev HEAD $before +' + +test_expect_success 'a "merge" into a root commit is a fast-forward' ' + head=$(git rev-parse HEAD) && + cat >script-from-scratch <<-EOF && + reset [new root] + merge $head + EOF + test_config sequence.editor \""$PWD"/replace-editor.sh\" && + test_tick && + git rebase -i -r HEAD^ && + test_cmp_rev HEAD $head +' + +test_expect_success 'A root commit can be a cousin, treat it that way' ' + git checkout --orphan khnum && + test_commit yama && + git checkout -b asherah master && + test_commit shamkat && + git merge --allow-unrelated-histories khnum && + test_tick && + git rebase -f -r HEAD^ && + ! test_cmp_rev HEAD^2 khnum && + test_cmp_graph HEAD^.. <<-\EOF && + * Merge branch '\''khnum'\'' into asherah + |\ + | * yama + o shamkat + EOF + test_tick && + git rebase --rebase-merges=rebase-cousins HEAD^ && + test_cmp_graph HEAD^.. <<-\EOF + * Merge branch '\''khnum'\'' into asherah + |\ + | * yama + |/ + o shamkat + EOF +' + test_expect_success 'labels that are object IDs are rewritten' ' git checkout -b third B && - test_tick && test_commit I && third=$(git rev-parse HEAD) && git checkout -b labels master &&