summaryrefslogtreecommitdiff
path: root/t/t3415-rebase-autosquash.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2010-12-04 00:13:06 (GMT)
committerJunio C Hamano <gitster@pobox.com>2010-12-04 00:13:06 (GMT)
commit9bec60d3a52fa10b276214f8d255d6ff05a04b77 (patch)
tree0952a0582193715b67d97de9cf8c0875455bc10d /t/t3415-rebase-autosquash.sh
parent45a7b55d6fe69581d12b83f63337eaa1015b6717 (diff)
parent7951bd3029a849411181935f84600ddbcd97cd0c (diff)
downloadgit-9bec60d3a52fa10b276214f8d255d6ff05a04b77.zip
git-9bec60d3a52fa10b276214f8d255d6ff05a04b77.tar.gz
git-9bec60d3a52fa10b276214f8d255d6ff05a04b77.tar.bz2
Merge branch 'pn/commit-autosquash'
* pn/commit-autosquash: add tests of commit --squash commit: --squash option for use with rebase --autosquash add tests of commit --fixup commit: --fixup option for use with rebase --autosquash pretty.c: teach format_commit_message() to reencode the output commit: helper methods to reduce redundant blocks of code Conflicts: Documentation/git-commit.txt t/t3415-rebase-autosquash.sh
Diffstat (limited to 't/t3415-rebase-autosquash.sh')
-rwxr-xr-xt/t3415-rebase-autosquash.sh29
1 files changed, 27 insertions, 2 deletions
diff --git a/t/t3415-rebase-autosquash.sh b/t/t3415-rebase-autosquash.sh
index ca16b70..b38be8e 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 &&
@@ -168,4 +169,28 @@ test_expect_success 'auto squash that matches longer sha1' '
test 1 = $(git cat-file commit HEAD^ | grep squash | wc -l)
'
+test_auto_commit_flags () {
+ git reset --hard base &&
+ echo 1 >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 <actual) &&
+ git diff --exit-code final-commit-$1 &&
+ test 1 = "$(git cat-file blob HEAD^:file1)" &&
+ test $2 = $(git cat-file commit HEAD^ | grep first | wc -l)
+}
+
+test_expect_success 'use commit --fixup' '
+ test_auto_commit_flags fixup 1
+'
+
+test_expect_success 'use commit --squash' '
+ test_auto_commit_flags squash 2
+'
+
test_done