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

Re: git rebase: retain original head?

From
Nazri Ramliy <ayiehere@gmail.com>
Date
Feb 27, 2019, 05:45 UTC
Message-ID
<CAEY4ZpPQxCVY5dZ_K9NRqF=YB0=s1nnJhnuDzL+ZytJ5uO2N7g@mail.gmail.com>
In-Reply-To
<nycvar.QRO.7.76.6.1901091501320.41@tvgsbejvaqbjf.bet>

On Wed, Jan 9, 2019 at 10:08 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?

Something like this, perhaps? ("gmail converts tabs to spaces" caveat applies to the diff formatting):

--8<--
diff --git t/t3400-rebase.sh t/t3400-rebase.sh
index 3e73f7584c..cb55597a8b 100755
--- t/t3400-rebase.sh
+++ t/t3400-rebase.sh
@@ -59,6 +59,13 @@ test_expect_success 'rebase against master' '
  git rebase master
 '

+test_expect_success 'rebase sets ORIG_HEAD' '
+ echo Add B. > expect &&
+ echo Modify A. >> expect &&
+ git log --oneline --format=%s ORIG_HEAD.. > actual &&
+ test_cmp expect actual
+'
+
 test_expect_success 'rebase, with <onto> and <upstream> specified as
:/quuxery' '
  test_when_finished "git branch -D torebase" &&
  git checkout -b torebase my-topic-branch^ &&
-->8--

Bisect shows that the first bad commit is this one:

commit 21853626eac565dd42572d90724b29863f61eb3b
Author: Johannes Schindelin <johannes.schindelin@gmx.de>
Date:   Fri Jan 18 07:09:27 2019 -0800

    built-in rebase: call `git am` directly

I verified that by undoing the crux of that commit, and that fixes the
failing test:

-->8--
diff --git builtin/rebase.c builtin/rebase.c
index 7c7bc13e91..848f6740a0 100644
--- builtin/rebase.c
+++ builtin/rebase.c
@@ -728,11 +728,6 @@ static int run_specific_rebase(struct rebase_options *opts)
  goto finished_rebase;
  }

- if (opts->type == REBASE_AM) {
- status = run_am(opts);
- goto finished_rebase;
- }
-
  add_var(&script_snippet, "GIT_DIR", absolute_path(get_git_dir()));
  add_var(&script_snippet, "state_dir", opts->state_dir);

--8<--

But something seems off by my bisection in that the "bad" commit
happens about 10 days after this email thread :/

nazri
Previous: Johannes SchindelinNext: Johannes Schindelin
Message 10 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.