summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorKevin Ballard <kevin@sb.org>2010-11-04 22:36:32 (GMT)
committerJunio C Hamano <gitster@pobox.com>2010-11-09 17:44:19 (GMT)
commit68d5d03bc49a073be3b0e14b22d30d70e7ae686d (patch)
tree11b5cefb1c1264156c2ed0a5a02d208baf44dc86 /t
parentd3d7a421b1439a6f08dfbcd2e3327cbe90c93417 (diff)
downloadgit-68d5d03bc49a073be3b0e14b22d30d70e7ae686d.zip
git-68d5d03bc49a073be3b0e14b22d30d70e7ae686d.tar.gz
git-68d5d03bc49a073be3b0e14b22d30d70e7ae686d.tar.bz2
rebase: teach --autosquash to match on sha1 in addition to message
Support lines of the form "fixup! 7a235b" that specify an exact commit in addition to the normal "squash! Old commit message" form. Signed-off-by: Kevin Ballard <kevin@sb.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-xt/t3415-rebase-autosquash.sh31
1 files changed, 31 insertions, 0 deletions
diff --git a/t/t3415-rebase-autosquash.sh b/t/t3415-rebase-autosquash.sh
index 712bbe8..ca16b70 100755
--- a/t/t3415-rebase-autosquash.sh
+++ b/t/t3415-rebase-autosquash.sh
@@ -136,5 +136,36 @@ test_expect_success 'auto squash that matches a commit after the squash' '
test 1 = $(git cat-file commit HEAD | grep third | wc -l) &&
test 1 = $(git cat-file commit HEAD^ | grep third | wc -l)
'
+test_expect_success 'auto squash that matches a sha1' '
+ git reset --hard base &&
+ echo 1 >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 <actual) &&
+ git diff --exit-code final-shasquash &&
+ test 1 = "$(git cat-file blob HEAD^:file1)" &&
+ test 1 = $(git cat-file commit HEAD^ | grep squash | wc -l)
+'
+
+test_expect_success 'auto squash that matches longer sha1' '
+ git reset --hard base &&
+ echo 1 >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 <actual) &&
+ git diff --exit-code final-longshasquash &&
+ test 1 = "$(git cat-file blob HEAD^:file1)" &&
+ test 1 = $(git cat-file commit HEAD^ | grep squash | wc -l)
+'
test_done