git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christian Couder <chriscool@tuxfamily.org>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, Ingo Molnar <mingo@elte.hu>,
	John Tapsell <johnflux@gmail.com>,
	Johannes Schindelin <Johannes.Schindelin@gmx.de>
Subject: [PATCH 6/7] rev-list: don't find all bisect commits if there are no skipped commits
Date: Thu, 12 Mar 2009 08:51:37 +0100	[thread overview]
Message-ID: <20090312085137.f58fa54b.chriscool@tuxfamily.org> (raw)

This patch optimizes the behavior of the "--bisect-skip" option of
"git rev-list", so that it does not try to find all possible bisection
points when only one is needed because there are no skipped commits.

This makes the behavior of "git rev-list --bisect-skip" similar as
what is done in "git-bisect.sh" to choose if it should pass the
"--bisect-all" option to "git rev-list". So this has the added
benefit that it will make the test suite pass as is when we will
use "--bisect-skip" in "git-bisect.sh" in a later patch.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
---
 bisect-skip.c      |    5 +++++
 bisect.h           |    1 +
 builtin-rev-list.c |    4 +++-
 3 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/bisect-skip.c b/bisect-skip.c
index 9228465..789ee09 100644
--- a/bisect-skip.c
+++ b/bisect-skip.c
@@ -28,6 +28,11 @@ void register_skipped(const char *skipped)
 	strbuf_release(&sb);
 }
 
+int skipped_nr(void)
+{
+	return skipped_sha1_nr;
+}
+
 static int skipcmp(const void *a, const void *b)
 {
 	return hashcmp(a, b);
diff --git a/bisect.h b/bisect.h
index c5f9fe1..ff9c781 100644
--- a/bisect.h
+++ b/bisect.h
@@ -2,6 +2,7 @@
 #define BISECT_H
 
 void register_skipped(const char *skipped);
+int skipped_nr(void);
 struct commit_list *filter_skipped(struct commit_list *list,
 				   struct commit_list **tried,
 				   int show_all);
diff --git a/builtin-rev-list.c b/builtin-rev-list.c
index 6e0466e..4af70d7 100644
--- a/builtin-rev-list.c
+++ b/builtin-rev-list.c
@@ -337,7 +337,6 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)
 		if (!prefixcmp(arg, "--bisect-skip=")) {
 			bisect_list = 1;
 			bisect_show_vars = 1;
-			bisect_find_all = 1;
 			bisect_skip = 1;
 			register_skipped(arg + 14);
 			continue;
@@ -384,6 +383,9 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)
 	if (bisect_list) {
 		int reaches = reaches, all = all;
 
+		if (bisect_skip && !bisect_find_all)
+			bisect_find_all = !!skipped_nr();
+
 		revs.commits = find_bisection(revs.commits, &reaches, &all,
 					      bisect_find_all);
 
-- 
1.6.2.83.g012a16.dirty

                 reply	other threads:[~2009-03-12  7:54 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20090312085137.f58fa54b.chriscool@tuxfamily.org \
    --to=chriscool@tuxfamily.org \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=johnflux@gmail.com \
    --cc=mingo@elte.hu \
    /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).