git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[BUG] fixup commit is dropped during rebase if subject = branch name

From
EEErik Cervin Edin <erik@cervined.in>
Date
Sep 17, 2022, 14:45 UTC
Message-ID
<CA+JQ7M_Xwxa48ggu88rhA9dG6R3u820Tgu8B2Kg-uMbEVjy3Vg@mail.gmail.com>

Thank you for filling out a Git bug report! Please answer the following questions to help us understand your issue.

What did you do before the bug happened? (Steps to reproduce your issue)
  dir=rebase-fixup-subject-equals-branch-name
  mkdir $dir
  cd $dir
  git init --initial-branch=main
  git commit -m init --allow-empty
  git tag init
  # failure
  seq 1 3 >> bar && git add bar && git commit -m main
  git tag -f x
  seq 4 6 >> bar && git add bar && git commit -m bar
  seq 7 9 >> bar && git add bar && git commit --fixup :/main
  git -c sequence.editor=: rebase --autosquash --interactive x
  git diff ORIG_HEAD
What did you expect to happen? (Expected behavior)
Identical results as
  # normal
  git reset --hard init
  seq 1 3 >> bar && git add bar && git commit -m main
  git tag -f x
  seq 4 6 >> bar && git add bar && git commit --fixup :/main
  seq 7 9 >> bar && git add bar && git commit -m bar
  git -c sequence.editor=: rebase --autosquash --interactive x
  git diff ORIG_HEAD
except for the order of the commits.

What happened instead? (Actual behavior) The fixup commit was dropped from the rebase-todo.

What's different between what you expected and what actually happened? The HEAD is a fixup of a commit with the same subject as the branch name. It is being rebased on top of the commit it is intended to fixup, so it should be *picked*. Instead, it is dropped from the rebase-todo. I expected the autosquash feature to work equally, independently of the subject and the current branch name.

Anything else you want to add: This appears to only occur if the subject is equal to the branch being rebased. I didn't check if this occurs if there is simply 'a' reference with an identical name in the repository (I'm guessing no).

Please review the rest of the bug report below. You can delete any lines you don't wish to share.

[System Info] git version: git version 2.37.3.windows.1 cpu: x86_64 built from commit: c4992d4fecabd7d111726ecb37e33a3ccb51d6f1 sizeof-long: 4 sizeof-size_t: 8 shell-path: /bin/sh feature: fsmonitor--daemon uname: Windows 10.0 19044 compiler info: gnuc: 12.2 libc info: no libc information available $SHELL (typically, interactive shell): C:\Users\erik\Git\usr\bin\bash.exe

[Enabled Hooks]
-- 
Erik Cervin-Edin
Next: Junio C Hamano
Message 1 of 19 in “[BUG] fixup commit is dropped during rebase if subject = branch name”
  1. Erik Cervin EdinSep 17, 2022
  2. Junio C HamanoSep 17, 2022
  3. Erik Cervin EdinSep 18, 2022
  4. Johannes AltmanningerSep 17, 2022
  5. sequencer: avoid dropping fixup commit that targets self via commit-ishJohannes Altmanninger, Sep 18, 2022
  6. Erik Cervin EdinSep 18, 2022
  7. Johannes AltmanningerSep 18, 2022
  8. Junio C HamanoSep 19, 2022
  9. Junio C HamanoSep 19, 2022
  10. Johannes AltmanningerSep 20, 2022
  11. Junio C HamanoSep 19, 2022
  12. sequencer: avoid dropping fixup commit that targets self via commit-ishJohannes Altmanninger, Sep 20, 2022
  13. Phillip WoodSep 20, 2022
  14. Junio C HamanoSep 21, 2022
  15. Johannes AltmanningerSep 22, 2022
  16. Junio C HamanoSep 22, 2022
  17. sequencer: avoid dropping fixup commit that targets self via commit-ishJohannes Altmanninger, Sep 24, 2022
  18. Junio C HamanoSep 19, 2022
  19. Johannes AltmanningerSep 20, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.