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>
This commit is contained in:

committed by
Junio C Hamano

parent
d3d7a421b1
commit
68d5d03bc4
@ -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
|
||||
|
Reference in New Issue
Block a user