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

Re: git-rebase skips automatically no more needed commits

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 15, 2011, 03:41 UTC
Message-ID
<7vwrdaqxpk.fsf@alter.siamese.dyndns.org>
In-Reply-To
<alpine.DEB.2.00.1109122139110.12564@debian>
Martin von Zweigbergk <martin.von.zweigbergk@gmail.com> writes:
Show 6 quoted lines
>  2. Somehow modify git-rebase--am.sh not to depend on format-patch. In
>     [1], Junio mentions rewriting git-rebase--am.sh "to have
>     format-patch avoid the cost of actually generating the patch text"
>     and "when using "am" for rebasing we do not really care anything
>     but the commit object names". If all we need is the commit name,
>     why would we not use cherry-pick/sequencer instead of git-am?

What I said is "all 'am' need to use from its input while rebasing is the commit object name"; that is very different from "we have only commit object name so we must use cherry-pick" or "because we have commit object name, we can afford to use cherry-pick".

Look for $rebasing in git-am.sh and notice that:
 - We run get-author-ident-from-commit on $commit to keep the authorship
   information in $dotest/author-script for later use, instead of letting
   them read from $dotest/info prepared by "mailinfo".
 - My "fixing it would be just the matter of doing this" patch in a
   separate thread we had recently ("mailinfo" would obviously have
   trouble telling where the message ends whilerebasing a change with
   patch text in the commit log message) adds a similar logic to extract
   the patch text out of $commit in the same place as above, to override
   what "mailinfo" prepares in $dotest/patch.
 - Even with the above two differences from the normal "separate the
   metainfo and patch from the mailbox, and use them" codepath, $rebasing
   codepath uses the same "git apply && git write-tree && git commit-tree"
   flow.

Use of "apply && write-tree && commit-tree" is to avoid the merge overhead of using cherry-pick, and historically, it used to matter a lot, because starting merge-recursive was very slow (it was a Python script). Even though we have merge-recursive rewritten in C these days, it probably still matters, especially for large-ish projects, because merge will trash the cached-tree information in the index, making write-tree inefficient.

Previous: Martin von ZweigbergkNext: Martin von Zweigbergk
Message 13 of 19 in “git-rebase skips automatically no more needed commits”
  1. Francis MoreauSep 6, 2011
  2. Junio C HamanoSep 6, 2011
  3. Francis MoreauSep 6, 2011
  4. Michael J GruberSep 7, 2011
  5. Junio C HamanoSep 7, 2011
  6. Francis MoreauSep 8, 2011
  7. Martin von ZweigbergkSep 8, 2011
  8. Martin von ZweigbergkSep 9, 2011
  9. Francis MoreauSep 9, 2011
  10. Martin von ZweigbergkSep 9, 2011
  11. Francis MoreauSep 9, 2011
  12. Martin von ZweigbergkSep 15, 2011
  13. Junio C HamanoSep 15, 2011
  14. Martin von ZweigbergkSep 16, 2011
  15. Martin von ZweigbergkSep 20, 2011
  16. Ramkumar RamachandraSep 24, 2011
  17. Martin von ZweigbergkSep 25, 2011
  18. Thomas RastSep 26, 2011
  19. Martin von ZweigbergkSep 28, 2011

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.