This should help both human and scripts deal better with "bisect-replace-*" branches. 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 966276b..85ee03e 100644 --- a/Documentation/rev-list-options.txt +++ b/Documentation/rev-list-options.txt @@ -507,6 +507,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 "bisect-replace-*" branches if any, +but will not perform other bisection calculation. + +The purpose of the "bisect-replace-*" branches 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 "bisect-replace-*" branches by +default when they perform their bisection calculations. With the +"--bisect-replace" option, you can see what is the result of using the +"bisect-replace-*" branches without the effects of other bisection +calculations. endif::git-rev-list[] diff --git a/builtin-rev-list.c b/builtin-rev-list.c index c0717f6..75cc1fc 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.6.0.3.619.g9a6a -- 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