[PATCH 6/7] rev-list: don't find all bisect commits if there are no skipped commits
From: Christian Couder <hidden>
Date: 2016-06-15 22:46:22
Subsystem:
the rest · Maintainer:
Linus Torvalds
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 <redacted> --- 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