#!/bin/sh test_description='auto squash' . ./test-lib.sh test_expect_success setup ' echo 0 >file0 && git add . && test_tick && git commit -m "initial commit" && echo 0 >file1 && echo 2 >file2 && git add . && test_tick && git commit -m "first commit" && git tag first-commit && echo 3 >file3 && git add . && test_tick && git commit -m "second commit" && git tag base ' test_auto_fixup () { git reset --hard base && echo 1 >file1 && git add -u && test_tick && git commit -m "fixup! first" && git tag $1 && test_tick && git rebase $2 -i HEAD^^^ && git log --oneline >actual && test 3 = $(wc -l file1 && git add -u && test_tick && git commit -m "squash! first" && git tag $1 && test_tick && git rebase $2 -i HEAD^^^ && git log --oneline >actual && test 3 = $(wc -l file1 && git add -u && test_tick && git commit -m "squash! forst" && git tag final-missquash && test_tick && git rebase --autosquash -i HEAD^^^ && git log --oneline >actual && test 4 = $(wc -l 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