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

Re: git rebase: retain original head?

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Feb 28, 2019, 10:10 UTC
Message-ID
<nycvar.QRO.7.76.6.1902281008000.41@tvgsbejvaqbjf.bet>
In-Reply-To
<CAEY4ZpPQxCVY5dZ_K9NRqF=YB0=s1nnJhnuDzL+ZytJ5uO2N7g@mail.gmail.com>
Hi Nazri,
On Wed, 27 Feb 2019, Nazri Ramliy wrote:
> On Wed, Jan 9, 2019 at 10:08 PM Johannes Schindelin
> <Johannes.Schindelin@gmx.de> wrote:
Oh wow. Better late than never, eh?
Show 28 quoted lines
> > 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--

I made it a little more stand-alone, and can confirm that this is now safely a regression in v2.21.0.

Show 32 quoted lines
> 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 :/

Yep, I had fixed the issue before this commit, and a regression test would have come in handy to prevent that regression from creeping in *again*.

Anyway, I'm on it. Johannes

P.S.: If you want to follow my progress, I'll push updates to the rebase-am-and-orig-head branch at https://github.com/dscho/git.

Previous: Nazri Ramliy
Message 11 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.