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

Re: time needed to rebase shortend by using --onto?

From
Junio C Hamano <gitster@pobox.com>
Date
May 26, 2021, 22:18 UTC
Message-ID
<xmqqim35b0kz.fsf@gitster.g>
In-Reply-To
<20210526100932.2hw4rbazgvd6mzff@pengutronix.de>
Uwe Kleine-König <u.kleine-koenig@pengutronix.de> writes:
Show 36 quoted lines
> It rebases clean on v5.10:
>
> 	$ time git rebase v5.10
> 	Performing inexact rename detection: 100% (36806539/36806539), done.
> 	Performing inexact rename detection: 100% (36806539/36806539), done.
> 	Performing inexact rename detection: 100% (36806539/36806539), done.
> 	Performing inexact rename detection: 100% (36806539/36806539), done.
> 	Successfully rebased and updated detached HEAD.
>
> 	real	3m47.841s
> 	user	1m25.706s
> 	sys	0m11.181s
>
> If I start with the same rev checked out and explicitly specify the
> merge base, the rebase process is considerably faster:
>
> 	$ time git rebase --onto v5.10 v5.4
> 	Performing inexact rename detection: 100% (36806539/36806539), done.
> 	Performing inexact rename detection: 100% (36806539/36806539), done.
> 	Performing inexact rename detection: 100% (36806539/36806539), done.
> 	Performing inexact rename detection: 100% (36806539/36806539), done.
> 	Successfully rebased and updated detached HEAD.
>
> 	real	1m20.588s
> 	user	1m12.645s
> 	sys	0m6.733s
>
> Is there some relevant complexity in the first invocation I'm not seeing
> that explains it takes more than the double time? I would have expected
> that
>
> 	git rebase v5.10
>
> does the same as:
>
> 	git rebase --onto v5.10 $(git merge-base HEAD v5.10)

There is a voodoo called fork-point detection that walks back the reflogs and repeatedly computes merge bases, and giving --onto to explicitly give a commit on which the history is transplanted should remove the need to do the computation, so that is a possibility.

But according to the manpage, it should not kick in for invocations in the above example that specify the <upstream> (the rebase.forkpoint configuration variable can clobber this default).

Previous: Felipe ContrerasNext: Uwe Kleine-König
Message 11 of 12 in “time needed to rebase shortend by using --onto?”
  1. Uwe Kleine-KönigMay 26, 2021
  2. Bagas SanjayaMay 26, 2021
  3. Elijah NewrenMay 26, 2021
  4. Uwe Kleine-KönigMay 27, 2021
  5. Uwe Kleine-KönigMay 27, 2021
  6. Elijah NewrenMay 28, 2021
  7. Elijah NewrenMay 27, 2021
  8. Uwe Kleine-KönigMay 28, 2021
  9. Elijah NewrenMay 28, 2021
  10. Felipe ContrerasMay 29, 2021
  11. Junio C HamanoMay 26, 2021
  12. Uwe Kleine-KönigMay 27, 2021

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.