xread, xwrite: limit size of IO to 8MB
[gitweb.git] / t / t3415-rebase-autosquash.sh
index a1e86c4097ba096245b11a991c39e79886ca2b91..41370ab998c72e14f269a257304b3e0cc4aebc8c 100755 (executable)
@@ -4,6 +4,8 @@ test_description='auto squash'
 
 . ./test-lib.sh
 
+. "$TEST_DIRECTORY"/lib-rebase.sh
+
 test_expect_success setup '
        echo 0 >file0 &&
        git add . &&
@@ -193,4 +195,59 @@ test_expect_success 'use commit --squash' '
        test_auto_commit_flags squash 2
 '
 
+test_auto_fixup_fixup () {
+       git reset --hard base &&
+       echo 1 >file1 &&
+       git add -u &&
+       test_tick &&
+       git commit -m "$1! first" &&
+       echo 2 >file1 &&
+       git add -u &&
+       test_tick &&
+       git commit -m "$1! $2! first" &&
+       git tag "final-$1-$2" &&
+       test_tick &&
+       (
+               set_cat_todo_editor &&
+               test_must_fail git rebase --autosquash -i HEAD^^^^ >actual &&
+               cat >expected <<-EOF &&
+               pick $(git rev-parse --short HEAD^^^) first commit
+               $1 $(git rev-parse --short HEAD^) $1! first
+               $1 $(git rev-parse --short HEAD) $1! $2! first
+               pick $(git rev-parse --short HEAD^^) second commit
+               EOF
+               test_cmp expected actual
+       ) &&
+       git rebase --autosquash -i HEAD^^^^ &&
+       git log --oneline >actual &&
+       test_line_count = 3 actual
+       git diff --exit-code "final-$1-$2" &&
+       test 2 = "$(git cat-file blob HEAD^:file1)" &&
+       if test "$1" = "fixup"
+       then
+               test 1 = $(git cat-file commit HEAD^ | grep first | wc -l)
+       elif test "$1" = "squash"
+       then
+               test 3 = $(git cat-file commit HEAD^ | grep first | wc -l)
+       else
+               false
+       fi
+}
+
+test_expect_success 'fixup! fixup!' '
+       test_auto_fixup_fixup fixup fixup
+'
+
+test_expect_success 'fixup! squash!' '
+       test_auto_fixup_fixup fixup squash
+'
+
+test_expect_success 'squash! squash!' '
+       test_auto_fixup_fixup squash squash
+'
+
+test_expect_success 'squash! fixup!' '
+       test_auto_fixup_fixup squash fixup
+'
+
 test_done