Merge branch 'ja/rebase-i-avoid-amending-self'

"git rebase -i" can mistakenly attempt to apply a fixup to a commit
itself, which has been corrected.

* ja/rebase-i-avoid-amending-self:
  sequencer: avoid dropping fixup commit that targets self via commit-ish
This commit is contained in:
Junio C Hamano
2022-10-10 10:08:43 -07:00
2 changed files with 15 additions and 2 deletions

View File

@ -232,6 +232,19 @@ test_expect_success 'auto squash that matches longer sha1' '
test_line_count = 1 actual
'
test_expect_success 'auto squash of fixup commit that matches branch name which points back to fixup commit' '
git reset --hard base &&
git commit --allow-empty -m "fixup! self-cycle" &&
git branch self-cycle &&
GIT_SEQUENCE_EDITOR="cat >tmp" git rebase --autosquash -i HEAD^^ &&
sed -ne "/^[^#]/{s/[0-9a-f]\{7,\}/HASH/g;p;}" tmp >actual &&
cat <<-EOF >expect &&
pick HASH second commit
pick HASH fixup! self-cycle # empty
EOF
test_cmp expect actual
'
test_auto_commit_flags () {
git reset --hard base &&
echo 1 >file1 &&