X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=t%2Ft3415-rebase-autosquash.sh;h=b38be8e93723991d717b6b7fb690560efb58c36d;hb=ff00b682f203eb39876b57404916b4c54b6032c6;hp=fd2184ce7159122ae8d1d65f5a228a7b91c5e02a;hpb=5ce3258122939f93a927c75d308c1c34038f0386;p=git.git diff --git a/t/t3415-rebase-autosquash.sh b/t/t3415-rebase-autosquash.sh index fd2184ce7..b38be8e93 100755 --- a/t/t3415-rebase-autosquash.sh +++ b/t/t3415-rebase-autosquash.sh @@ -14,6 +14,7 @@ test_expect_success setup ' git add . && test_tick && git commit -m "first commit" && + git tag first-commit && echo 3 >file3 && git add . && test_tick && @@ -21,7 +22,7 @@ test_expect_success setup ' git tag base ' -test_auto_fixup() { +test_auto_fixup () { git reset --hard base && echo 1 >file1 && git add -u && @@ -50,7 +51,7 @@ test_expect_success 'auto fixup (config)' ' test_must_fail test_auto_fixup final-fixup-config-false ' -test_auto_squash() { +test_auto_squash () { git reset --hard base && echo 1 >file1 && git add -u && @@ -94,4 +95,102 @@ test_expect_success 'misspelled auto squash' ' test 0 = $(git rev-list final-missquash...HEAD | wc -l) ' +test_expect_success 'auto squash that matches 2 commits' ' + git reset --hard base && + echo 4 >file4 && + git add file4 && + test_tick && + git commit -m "first new commit" && + echo 1 >file1 && + git add -u && + test_tick && + git commit -m "squash! first" && + git tag final-multisquash && + test_tick && + git rebase --autosquash -i HEAD~4 && + git log --oneline >actual && + test 4 = $(wc -l file1 && + git add -u && + test_tick && + git commit -m "squash! third" && + echo 4 >file4 && + git add file4 && + test_tick && + git commit -m "third commit" && + git tag final-presquash && + test_tick && + git rebase --autosquash -i HEAD~4 && + git log --oneline >actual && + test 5 = $(wc -l file1 && + git add -u && + test_tick && + git commit -m "squash! $(git rev-parse --short HEAD^)" && + git tag final-shasquash && + test_tick && + git rebase --autosquash -i HEAD^^^ && + git log --oneline >actual && + test 3 = $(wc -l file1 && + git add -u && + test_tick && + git commit -m "squash! $(git rev-parse --short=11 HEAD^)" && + git tag final-longshasquash && + test_tick && + git rebase --autosquash -i HEAD^^^ && + git log --oneline >actual && + test 3 = $(wc -l file1 && + git add -u && + test_tick && + git commit --$1 first-commit && + git tag final-commit-$1 && + test_tick && + git rebase --autosquash -i HEAD^^^ && + git log --oneline >actual && + test 3 = $(wc -l