X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=t%2Ft3400-rebase.sh;h=be7ae5a0041a0d06b40a7152d4c5d495a842a87f;hb=d890d3f99635de7963effd1436148112ef7a52b7;hp=496f4ec17217769228954116528b0fc0c1ef2a62;hpb=f23ffbe890d36e277f02d4a84c2b52de3a4e3173;p=git.git diff --git a/t/t3400-rebase.sh b/t/t3400-rebase.sh index 496f4ec17..be7ae5a00 100755 --- a/t/t3400-rebase.sh +++ b/t/t3400-rebase.sh @@ -9,21 +9,23 @@ This test runs git rebase and checks that the author information is not lost. ' . ./test-lib.sh -export GIT_AUTHOR_EMAIL=bogus_email_address +GIT_AUTHOR_EMAIL=bogus_email_address +export GIT_AUTHOR_EMAIL test_expect_success \ 'prepare repository with topic branches' \ - 'echo First > A && + 'git config core.logAllRefUpdates true && + echo First > A && git update-index --add A && - git-commit -m "Add A." && + git commit -m "Add A." && git checkout -b my-topic-branch && echo Second > B && git update-index --add B && - git-commit -m "Add B." && + git commit -m "Add B." && git checkout -f master && echo Third >> A && git update-index A && - git-commit -m "Modify A." && + git commit -m "Modify A." && git checkout -b side my-topic-branch && echo Side >> C && git add C && @@ -44,13 +46,17 @@ test_expect_success 'rebase against master' ' test_expect_success \ 'the rebase operation should not have destroyed author information' \ - '! git log | grep "Author:" | grep "<>"' + '! (git log | grep "Author:" | grep "<>")' + +test_expect_success 'HEAD was detached during rebase' ' + test $(git rev-parse HEAD@{1}) != $(git rev-parse my-topic-branch@{1}) +' test_expect_success 'rebase after merge master' ' git reset --hard topic && git merge master && git rebase master && - ! git show | grep "^Merge:" + ! (git show | grep "^Merge:") ' test_expect_success 'rebase of history with merges is linearized' ' @@ -83,4 +89,10 @@ test_expect_success 'rebase a single mode change' ' GIT_TRACE=1 git rebase master ' +test_expect_success 'Show verbose error when HEAD could not be detached' ' + : > B && + test_must_fail git rebase topic 2> output.err > output.out && + grep "Untracked working tree file .B. would be overwritten" output.err +' + test_done