3 test_description
='auto squash'
7 test_expect_success setup
'
11 git commit -m "initial commit" &&
16 git commit -m "first commit" &&
20 git commit -m "second commit" &&
24 test_expect_success
'auto fixup' '
25 git reset --hard base &&
29 git commit -m "fixup! first"
31 git tag final-fixup &&
33 git rebase --autosquash -i HEAD^^^ &&
34 git log --oneline >actual &&
35 test 3 = $(wc -l <actual) &&
36 git diff --exit-code final-fixup &&
37 test 1 = "$(git cat-file blob HEAD^:file1)" &&
38 test 1 = $(git cat-file commit HEAD^ | grep first | wc -l)
41 test_expect_success
'auto squash' '
42 git reset --hard base &&
46 git commit -m "squash! first"
48 git tag final-squash &&
50 git rebase --autosquash -i HEAD^^^ &&
51 git log --oneline >actual &&
52 test 3 = $(wc -l <actual) &&
53 git diff --exit-code final-squash &&
54 test 1 = "$(git cat-file blob HEAD^:file1)" &&
55 test 2 = $(git cat-file commit HEAD^ | grep first | wc -l)
58 test_expect_success
'misspelled auto squash' '
59 git reset --hard base &&
63 git commit -m "squash! forst"
64 git tag final-missquash &&
66 git rebase --autosquash -i HEAD^^^ &&
67 git log --oneline >actual &&
68 test 4 = $(wc -l <actual) &&
69 git diff --exit-code final-missquash &&
70 test 0 = $(git rev-list final-missquash...HEAD | wc -l)