git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Rast <trast@student.ethz.ch>
To: <git@vger.kernel.org>
Cc: Junio C Hamano <gitster@pobox.com>,
	Laine Walker-Avina <lwalkera@pasco.com>
Subject: Re: [PATCH] rebase -i: avoid --cherry-pick when rebasing to a direct ancestor
Date: Sat, 20 Feb 2010 01:02:15 +0100	[thread overview]
Message-ID: <201002200102.15777.trast@student.ethz.ch> (raw)
In-Reply-To: <d1a75633daa062b25527dfb0675673480974c940.1266620423.git.trast@student.ethz.ch>

On Saturday 20 February 2010 00:30:52 Thomas Rast wrote:
> 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

  reply	other threads:[~2010-02-20  0:02 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-19 21:24 Git has bad performance when traversing change-sets with large PPM files Laine Walker-Avina
2010-02-19 23:30 ` [PATCH] rebase -i: avoid --cherry-pick when rebasing to a direct ancestor Thomas Rast
2010-02-20  0:02   ` Thomas Rast [this message]
2010-02-20  7:27     ` Jeff King
2010-02-20 11:42       ` [PATCH] cherry_pick_list: quit early if one side is empty Thomas Rast
2010-02-21  6:50         ` Jeff King
2010-02-20 13:38       ` [PATCH] rebase -i: avoid --cherry-pick when rebasing to a direct ancestor Thomas Rast
2010-02-21  7:46         ` Jeff King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201002200102.15777.trast@student.ethz.ch \
    --to=trast@student.ethz.ch \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=lwalkera@pasco.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).