Merge branch 'tr/xsize-bits' into maint
[tgit.git] / t / t3415-rebase-autosquash.sh
blobb63f4e2d677b6b4827d39a51a3c39719a8ab5b4f
1 #!/bin/sh
3 test_description='auto squash'
5 . ./test-lib.sh
7 test_expect_success setup '
8 echo 0 >file0 &&
9 git add . &&
10 test_tick &&
11 git commit -m "initial commit" &&
12 echo 0 >file1 &&
13 echo 2 >file2 &&
14 git add . &&
15 test_tick &&
16 git commit -m "first commit" &&
17 echo 3 >file3 &&
18 git add . &&
19 test_tick &&
20 git commit -m "second commit" &&
21 git tag base
24 test_expect_success 'auto fixup' '
25 git reset --hard base &&
26 echo 1 >file1 &&
27 git add -u &&
28 test_tick &&
29 git commit -m "fixup! first"
31 git tag final-fixup &&
32 test_tick &&
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 &&
43 echo 1 >file1 &&
44 git add -u &&
45 test_tick &&
46 git commit -m "squash! first"
48 git tag final-squash &&
49 test_tick &&
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 &&
60 echo 1 >file1 &&
61 git add -u &&
62 test_tick &&
63 git commit -m "squash! forst"
64 git tag final-missquash &&
65 test_tick &&
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)
73 test_done