From: Junio C Hamano <gitster@pobox.com>
To: git@vger.kernel.org
Cc: Thomas Rast <trast@student.ethz.ch>, Jeff King <peff@peff.net>
Subject: [PATCH 4/5] in_merge_bases(): omit unnecessary redundant common ancestor reduction
Date: Mon, 27 Aug 2012 16:12:02 -0700 [thread overview]
Message-ID: <1346109123-12357-5-git-send-email-gitster@pobox.com> (raw)
In-Reply-To: <1346109123-12357-1-git-send-email-gitster@pobox.com>
The function get_merge_bases() needs to postprocess the result from
merge_bases_many() in order to make sure none of the commit is a
true ancestor of another commit, which is expensive. However, when
checking if a commit is an ancestor of another commit, we only need
to see if the commit is a common ancestor between the two, and do
not have to care if other common ancestors merge_bases_many() finds
are true merge bases or an ancestor of another merge base.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
commit.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/commit.c b/commit.c
index 74ec5f1..f5211bd 100644
--- a/commit.c
+++ b/commit.c
@@ -806,7 +806,10 @@ int in_merge_bases(struct commit *commit, struct commit *reference)
struct commit_list *bases, *b;
int ret = 0;
- bases = get_merge_bases(commit, reference, 1);
+ bases = merge_bases_many(commit, 1, &reference);
+ clear_commit_marks(commit, all_flags);
+ clear_commit_marks(reference, all_flags);
+
for (b = bases; b; b = b->next) {
if (!hashcmp(commit->object.sha1, b->item->object.sha1)) {
ret = 1;
--
1.7.12.116.g31e0100
next prev parent reply other threads:[~2012-08-27 23:12 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-27 23:11 [PATCH 0/5] optimize fast-forward checks Junio C Hamano
2012-08-27 23:11 ` [PATCH 1/5] in_merge_bases(): support only one "other" commit Junio C Hamano
2012-08-27 23:12 ` [PATCH 2/5] receive-pack: use in_merge_bases() for fast-forward check Junio C Hamano
2012-08-27 23:12 ` [PATCH 3/5] http-push: " Junio C Hamano
2012-08-27 23:12 ` Junio C Hamano [this message]
2012-08-27 23:12 ` [PATCH 5/5] (BROKEN) get_merge_bases_many(): walk from many tips in parallel Junio C Hamano
2012-08-28 1:25 ` Junio C Hamano
2012-08-28 21:35 ` Junio C Hamano
2012-08-28 23:39 ` Junio C Hamano
2012-08-29 11:08 ` Jeff King
2012-08-29 11:10 ` [PATCH 1/2] basic priority queue implementation Jeff King
2012-08-29 11:11 ` [PATCH 2/2] commit: use a priority queue in merge base functions Jeff King
2012-08-29 16:36 ` Junio C Hamano
2012-08-29 20:53 ` Jeff King
2012-08-29 20:55 ` Jeff King
2012-08-29 21:00 ` Jeff King
2012-08-29 21:05 ` Jeff King
2012-08-30 12:54 ` Jeff King
2012-08-30 13:03 ` Jeff King
2012-08-30 13:24 ` Jeff King
2012-08-30 16:33 ` Junio C Hamano
2012-08-30 21:48 ` Jeff King
2012-08-30 22:16 ` Junio C Hamano
2012-08-30 16:23 ` Junio C Hamano
2012-08-30 21:31 ` Jeff King
2012-08-30 21:59 ` Junio C Hamano
2012-08-29 21:18 ` Junio C Hamano
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=1346109123-12357-5-git-send-email-gitster@pobox.com \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=peff@peff.net \
--cc=trast@student.ethz.ch \
/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).