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

Re: git rebase: retain original head?

From
MWMarkus Wiederkehr <markus.wiederkehr@gmail.com>
Date
Jan 9, 2019, 15:08 UTC
Message-ID
<CA+h-Bnvp3mrXBqqY+mdD36feOkx1EhnnQtDXrmPhyW4KzKb_3w@mail.gmail.com>
In-Reply-To
<nycvar.QRO.7.76.6.1901091501320.41@tvgsbejvaqbjf.bet>

On Wed, Jan 9, 2019 at 3:05 PM Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:

>
> Having said that, it is an unintended regression in the built-in rebase.
> Markus, could you come up with a minimal test case, preferably in the form
> of a patch to t/t3415-rebase-autosquash.sh?

I don't think I'm familiar enough with the test code to be able to provide a good patch but the following code should illustrate the regression.

git init testrepo cd testrepo echo 1 > file && git add file && git commit -m "initial" echo 1 >> file && git commit -am "commit 1" # rev_commit_1=$(git rev-parse HEAD) echo 1 >> file && git commit -am "fixup! $(git rev-parse --short HEAD)" echo 1 >> file && git commit -am "commit 3" rev_orig_head=$(git rev-parse HEAD) GIT_EDITOR=: git rebase --autosquash -i HEAD~3 test $(git rev-parse ORIG_HEAD) = $rev_orig_head

In older versions of git this test succeeded, i.e. ORIG_HEAD pointed to the previous original head, $rev_orig_head. In git version 2.20.1 ORIG_HEAD now points to the commit that got fixuped instead, $rev_commit_1.

In previous versions ORIG_HEAD only pointed somewhere else if "git reset" was invoked manually during the rebase operation. I'm not sure if this is desirable, maybe ORIG_HEAD should always point to the previous head after rebase completes, no matter what operations were run in between. What do you think?

Markus
Previous: Johannes SchindelinNext: Johannes Schindelin
Message 8 of 11 in “git rebase: retain original head?”
  1. Markus WiederkehrJan 8, 2019
  2. Andreas SchwabJan 8, 2019
  3. Markus WiederkehrJan 8, 2019
  4. Andreas SchwabJan 8, 2019
  5. Markus WiederkehrJan 9, 2019
  6. Jacob KellerJan 8, 2019
  7. Johannes SchindelinJan 9, 2019
  8. Markus WiederkehrJan 9, 2019
  9. Johannes SchindelinJan 11, 2019
  10. Nazri RamliyFeb 27, 2019
  11. Johannes SchindelinFeb 28, 2019

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.