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

Re: [PATCH] rebase: use correct base for --keep-base when a branch is given

From
Alex Henrie <alexhenrie24@gmail.com>
Date
Apr 21, 2022, 04:38 UTC
Message-ID
<CAMMLpeTLkg7=WwhpkpA53bQ5ucSPH3zTXRdhR7uj9OKA=7s=kw@mail.gmail.com>
In-Reply-To
<xmqqh76no53x.fsf@gitster.g>
On Wed, Apr 20, 2022 at 2:46 PM Junio C Hamano <gitster@pobox.com> wrote:
>
> It is surprising that a basic and trivial bug was with us forever.

I was also surprised. Like you, I dug through the mailing list archives and my impression was that the code review was mostly concerned about the case where there are multiple merge bases. No one seemed to have read the man page closely enough to notice that 'git rebase --keep-base <upstream> <branch>' cannot be equivalent to 'git rebase --onto <upstream>... <upstream>' because the latter doesn't have <branch> at all. Seeing that discrepancy is what prompted me to try out what actually happens when the branch is specified on the command line, and then I realized that it was more than just a documentation error.

Show 16 quoted lines
> > +test_expect_success 'rebase --keep-base main topic from main' '
> > +     git reset --hard &&
>
> Clearing whatever cruft the last test left is good, but ...
>
> > +     git checkout topic &&
> > +     git reset --hard G &&
> > +     git checkout main &&
>
> it would be more efficient to just do
>
>         git checkout main &&
>         git branch -f topic G &&
>
> no?  Instead of rewriting the working tree three times, you only
> need to do so once here.
Sure. I'll make that change.
-Alex
Previous: Junio C HamanoNext: Alex Henrie
Message 3 of 4 in “rebase: use correct base for --keep-base when a branch is given”
  1. rebase: use correct base for --keep-base when a branch is givenAlex Henrie, Apr 18, 2022
  2. Junio C HamanoApr 20, 2022
  3. Alex HenrieApr 21, 2022
  4. rebase: use correct base for --keep-base when a branch is givenAlex Henrie, Apr 21, 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.