X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=t%2Ft3404-rebase-interactive.sh;h=4becc5513dc3f46b73fbe8d7ea09a4c2912aa0a2;hb=f29d669a91b2c8f1c68c1f4fb10f03456a997fa8;hp=e0ded197ecabce712ac1eeaa4c959c714f0e9d34;hpb=ed520a8f270253f4a779aece1352b10fb9a689de;p=git.git diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh index e0ded197e..4becc5513 100755 --- a/t/t3404-rebase-interactive.sh +++ b/t/t3404-rebase-interactive.sh @@ -373,6 +373,38 @@ test_expect_success '--continue tries to commit, even for "edit"' ' test $parent = $(git rev-parse HEAD^) ' +test_expect_success 'aborted --continue does not squash commits after "edit"' ' + old=$(git rev-parse HEAD) && + test_tick && + FAKE_LINES="edit 1" git rebase -i HEAD^ && + echo "edited again" > file7 && + git add file7 && + ( + FAKE_COMMIT_MESSAGE=" " && + export FAKE_COMMIT_MESSAGE && + test_must_fail git rebase --continue + ) && + test $old = $(git rev-parse HEAD) && + git rebase --abort +' + +test_expect_success 'auto-amend only edited commits after "edit"' ' + test_tick && + FAKE_LINES="edit 1" git rebase -i HEAD^ && + echo "edited again" > file7 && + git add file7 && + FAKE_COMMIT_MESSAGE="edited file7 again" git commit && + echo "and again" > file7 && + git add file7 && + test_tick && + ( + FAKE_COMMIT_MESSAGE="and again" && + export FAKE_COMMIT_MESSAGE && + test_must_fail git rebase --continue + ) && + git rebase --abort +' + test_expect_success 'rebase a detached HEAD' ' grandparent=$(git rev-parse HEAD~2) && git checkout $(git rev-parse HEAD) && @@ -419,4 +451,41 @@ test_expect_success 'rebase with a file named HEAD in worktree' ' ' +test_expect_success 'do "noop" when there is nothing to cherry-pick' ' + + git checkout -b branch4 HEAD && + GIT_EDITOR=: git commit --amend \ + --author="Somebody else " + test $(git rev-parse branch3) != $(git rev-parse branch4) && + git rebase -i branch3 && + test $(git rev-parse branch3) = $(git rev-parse branch4) + +' + +test_expect_success 'submodule rebase setup' ' + git checkout A && + mkdir sub && + ( + cd sub && git init && >elif && + git add elif && git commit -m "submodule initial" + ) && + echo 1 >file1 && + git add file1 sub + test_tick && + git commit -m "One" && + echo 2 >file1 && + test_tick && + git commit -a -m "Two" && + ( + cd sub && echo 3 >elif && + git commit -a -m "submodule second" + ) && + test_tick && + git commit -a -m "Three changes submodule" +' + +test_expect_success 'submodule rebase -i' ' + FAKE_LINES="1 squash 2 3" git rebase -i A +' + test_done