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

Re: [PATCH] rebase -i: avoid --cherry-pick when rebasing to a direct ancestor

From
Thomas Rast <trast@student.ethz.ch>
Date
Feb 20, 2010, 00:02 UTC
Message-ID
<201002200102.15777.trast@student.ethz.ch>
In-Reply-To
<d1a75633daa062b25527dfb0675673480974c940.1266620423.git.trast@student.ethz.ch>
On Saturday 20 February 2010 00:30:52 Thomas Rast wrote:
Show 8 quoted lines
> Ordinary 'rebase -i' reads the commits to rebase with (roughly)
> 
>   git rev-list --left-right --cherry-pick $upstream...
> 
> which gives it the feature of skipping commits that are already
> present in $upstream.  However, in the common use-case of rewriting a
> few commits up to an ancestor, as in 'git rebase -i HEAD~3', the
> --cherry-pick is useless since there are no commits to compare to.
[...]
> The --cherry-pick mechanism itself could get a similar optimization,
> but I don't know that code.
Or maybe it's as simple as this?
diff --git i/revision.c w/revision.c
index 438cc87..29721ec 100644
--- i/revision.c
+++ w/revision.c
@@ -547,6 +547,9 @@ static void cherry_pick_list(struct commit_list *list, struct rev_info *revs)
 			right_count++;
 	}
 
+	if (!left_count || !right_count)
+		return;
+
 	left_first = left_count < right_count;
 	init_patch_ids(&ids);
 	if (revs->diffopt.nr_paths) {
-- 
Thomas Rast
trast@{inf,student}.ethz.ch
Previous: Thomas RastNext: Jeff King
Message 3 of 8 in “Git has bad performance when traversing change-sets with large PPM files”
  1. Laine Walker-AvinaFeb 19, 2010
  2. rebase -i: avoid --cherry-pick when rebasing to a direct ancestorThomas Rast, Feb 19, 2010
  3. Thomas RastFeb 20, 2010
  4. Jeff KingFeb 20, 2010
  5. cherry_pick_list: quit early if one side is emptyThomas Rast, Feb 20, 2010
  6. Jeff KingFeb 21, 2010
  7. Thomas RastFeb 20, 2010
  8. Jeff KingFeb 21, 2010

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.