git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 8/9 v5] rev-list: make it possible to disable replacing using "--no-bisect-replace"
@ 2008-11-24 21:20 Christian Couder
  0 siblings, 0 replies; only message in thread
From: Christian Couder @ 2008-11-24 21:20 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Johannes Schindelin, H. Peter Anvin

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
---
 Documentation/git-rev-list.txt     |    1 +
 Documentation/rev-list-options.txt |   10 ++++++++++
 builtin-rev-list.c                 |   20 ++++++++++++++++----
 t/t6035-bisect-replace.sh          |   10 ++++++++++
 4 files changed, 37 insertions(+), 4 deletions(-)

diff --git a/Documentation/git-rev-list.txt b/Documentation/git-rev-list.txt
index 4cc8abf..b466da3 100644
--- a/Documentation/git-rev-list.txt
+++ b/Documentation/git-rev-list.txt
@@ -42,6 +42,7 @@ SYNOPSIS
 	     [ \--bisect-vars ]
 	     [ \--bisect-all ]
 	     [ \--bisect-replace ]
+	     [ \--no-bisect-replace ]
 	     [ \--merge ]
 	     [ \--reverse ]
 	     [ \--walk-reflogs ]
diff --git a/Documentation/rev-list-options.txt b/Documentation/rev-list-options.txt
index b35f9d8..9abdaee 100644
--- a/Documentation/rev-list-options.txt
+++ b/Documentation/rev-list-options.txt
@@ -589,6 +589,16 @@ default when they perform their bisection calculations. With the
 "--bisect-replace" option, you can see what is the result of using the
 "refs/replace/bisect/*" refs without the effects of other bisection
 calculations.
+
+--no-bisect-replace::
+
+With this option, 'rev-list' will not make use of the
+"refs/replace/bisect/*" refs, even if another `--bisect*` option is
+used.
+
+By default, if any `--bisect*` option is used, 'rev-list' will graft
+commits given by "refs/replace/bisect/*" refs into other branches when
+bisecting, so that bisection can be performed on a fixed up history.
 endif::git-rev-list[]
 
 
diff --git a/builtin-rev-list.c b/builtin-rev-list.c
index 1b18c65..e8febd0 100644
--- a/builtin-rev-list.c
+++ b/builtin-rev-list.c
@@ -48,13 +48,20 @@ static const char rev_list_usage[] =
 "    --bisect\n"
 "    --bisect-vars\n"
 "    --bisect-all\n"
-"    --bisect-replace"
+"    --bisect-replace\n"
+"    --no-bisect-replace"
 ;
 
 static struct rev_info revs;
 
+enum {
+	REPLACE_UNSET,
+	REPLACE_DEFAULT,
+	REPLACE_SET
+};
+
 static int bisect_list;
-static int bisect_replace_only;
+static int bisect_force_replace = REPLACE_DEFAULT;
 static int show_timestamp;
 static int hdr_termination;
 static const char *header_prefix;
@@ -684,7 +691,11 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)
 			continue;
 		}
 		if (!strcmp(arg, "--bisect-replace")) {
-			bisect_replace_only = 1;
+			bisect_force_replace = REPLACE_SET;
+			continue;
+		}
+		if (!strcmp(arg, "--no-bisect-replace")) {
+			bisect_force_replace = REPLACE_UNSET;
 			continue;
 		}
 		if (!strcmp(arg, "--stdin")) {
@@ -719,7 +730,8 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)
 	save_commit_buffer = revs.verbose_header ||
 		revs.grep_filter.pattern_list;
 
-	if (bisect_list || bisect_replace_only)
+	if (bisect_force_replace != REPLACE_UNSET &&
+	    (bisect_list || bisect_force_replace == REPLACE_SET))
 		bisect_replace_all();
 	if (bisect_list)
 		revs.limited = 1;
diff --git a/t/t6035-bisect-replace.sh b/t/t6035-bisect-replace.sh
index dabf1ae..f22a2e5 100755
--- a/t/t6035-bisect-replace.sh
+++ b/t/t6035-bisect-replace.sh
@@ -154,6 +154,16 @@ test_expect_success 'git bisect works when starting on the replace branch' '
      git bisect reset
 '
 
+test_expect_success '"git rev-list --no-bisect-replace" works' '
+     git rev-list --bisect-all --no-bisect-replace $HASH6 > rev_list.txt &&
+     test_must_fail grep $HASHFIX2 rev_list.txt &&
+     test_must_fail grep $HASHFIX3 rev_list.txt &&
+     test_must_fail grep $HASHFIX4 rev_list.txt &&
+     grep $HASH2 rev_list.txt &&
+     grep $HASH3 rev_list.txt &&
+     grep $HASH4 rev_list.txt
+'
+
 #
 #
 test_done
-- 
1.5.6.1.1657.g6a50

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2008-11-24 21:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-24 21:20 [PATCH 8/9 v5] rev-list: make it possible to disable replacing using "--no-bisect-replace" Christian Couder

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).