[PATCH 4/9 v5] rev-list: add "--bisect-replace" to list revisions with fixed up history

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This should help both human and scripts deal better with
"refs/replace/bisect/*" refs.

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

diff --git a/Documentation/git-rev-list.txt b/Documentation/git-rev-list.txt
index 1c9cc28..4cc8abf 100644
--- a/Documentation/git-rev-list.txt
+++ b/Documentation/git-rev-list.txt
@@ -41,6 +41,7 @@ SYNOPSIS
 	     [ \--bisect ]
 	     [ \--bisect-vars ]
 	     [ \--bisect-all ]
+	     [ \--bisect-replace ]
 	     [ \--merge ]
 	     [ \--reverse ]
 	     [ \--walk-reflogs ]
diff --git a/Documentation/rev-list-options.txt b/Documentation/rev-list-options.txt
index b9f6e4d..b35f9d8 100644
--- a/Documentation/rev-list-options.txt
+++ b/Documentation/rev-list-options.txt
@@ -574,6 +574,21 @@ may not compile for example).
 This option can be used along with `--bisect-vars`, in this case,
 after all the sorted commit objects, there will be the same text as if
 `--bisect-vars` had been used alone.
+
+--bisect-replace::
+
+This option will make use of the "refs/replace/bisect/*" refs if any,
+but will not perform other bisection calculation.
+
+The purpose of the "refs/replace/bisect/*" refs is to be grafted into
+other branches when bisecting, so that bisection can be performed on a
+fixed up history.
+
+The other `--bisect*` options use the "refs/replace/bisect/*" refs by
+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.
 endif::git-rev-list[]
 
 
diff --git a/builtin-rev-list.c b/builtin-rev-list.c
index 8adf269..693023f 100644
--- a/builtin-rev-list.c
+++ b/builtin-rev-list.c
@@ -47,12 +47,14 @@ static const char rev_list_usage[] =
 "  special purpose:\n"
 "    --bisect\n"
 "    --bisect-vars\n"
-"    --bisect-all"
+"    --bisect-all\n"
+"    --bisect-replace"
 ;
 
 static struct rev_info revs;
 
 static int bisect_list;
+static int bisect_replace_only;
 static int show_timestamp;
 static int hdr_termination;
 static const char *header_prefix;
@@ -681,6 +683,10 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)
 			bisect_show_vars = 1;
 			continue;
 		}
+		if (!strcmp(arg, "--bisect-replace")) {
+			bisect_replace_only = 1;
+			continue;
+		}
 		if (!strcmp(arg, "--stdin")) {
 			if (read_from_stdin++)
 				die("--stdin given twice?");
@@ -713,10 +719,10 @@ 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) {
+	if (bisect_list || bisect_replace_only)
 		bisect_replace_all();
+	if (bisect_list)
 		revs.limited = 1;
-	}
 
 	if (prepare_revision_walk(&revs))
 		die("revision walk setup failed");
diff --git a/t/t6035-bisect-replace.sh b/t/t6035-bisect-replace.sh
index 6ab3667..bc07206 100755
--- a/t/t6035-bisect-replace.sh
+++ b/t/t6035-bisect-replace.sh
@@ -125,6 +125,18 @@ test_expect_success 'standard bisect works' '
      git bisect reset
 '
 
+test_expect_success '"git rev-list --bisect-replace" works' '
+     echo "$HASH7" >> rev_list.expect &&
+     echo "$HASH6" >> rev_list.expect &&
+     echo "$HASH5" >> rev_list.expect &&
+     echo "$HASHFIX4" >> rev_list.expect &&
+     echo "$HASHFIX3" >> rev_list.expect &&
+     echo "$HASHFIX2" >> rev_list.expect &&
+     echo "$HASH1" >> rev_list.expect &&
+     git rev-list --bisect-replace $HASH7 > rev_list.output &&
+     test_cmp rev_list.expect rev_list.output
+'
+
 #
 #
 test_done
-- 
1.5.6.1.1657.g6a50

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux