{"thread":{"id":"16222","subject":"[PATCH 4/7 v3] rev-list: add \"--bisect-replace\" to list revisions with fixed up history","startedAt":"2008-11-08T07:49:42Z","lastAt":"2008-11-08T07:49:42Z","messageCount":1,"participants":["Christian Couder"],"isPatch":true,"patchVersion":3,"patchTotal":7},"messages":[{"id":"95198","messageId":"20081108084942.620dd23d.chriscool@tuxfamily.org","threadId":"16222","inReplyTo":null,"subject":"[PATCH 4/7 v3] rev-list: add \"--bisect-replace\" to list revisions with fixed up history","fromName":"Christian Couder","fromEmail":"chriscool@tuxfamily.org","sentAt":"2008-11-08T07:49:42Z","receivedAt":"2008-11-08T07:49:42Z","isPatch":true,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"This should help both human and scripts deal better with\n\"bisect-replace-*\" branches.\n\nSigned-off-by: Christian Couder <chriscool@tuxfamily.org>\n---\n Documentation/git-rev-list.txt     |    1 +\n Documentation/rev-list-options.txt |   15 +++++++++++++++\n builtin-rev-list.c                 |   12 +++++++++---\n t/t6035-bisect-replace.sh          |   12 ++++++++++++\n 4 files changed, 37 insertions(+), 3 deletions(-)\n\ndiff --git a/Documentation/git-rev-list.txt b/Documentation/git-rev-list.txt\nindex 1c9cc28..4cc8abf 100644\n--- a/Documentation/git-rev-list.txt\n+++ b/Documentation/git-rev-list.txt\n@@ -41,6 +41,7 @@ SYNOPSIS\n \t     [ \\--bisect ]\n \t     [ \\--bisect-vars ]\n \t     [ \\--bisect-all ]\n+\t     [ \\--bisect-replace ]\n \t     [ \\--merge ]\n \t     [ \\--reverse ]\n \t     [ \\--walk-reflogs ]\ndiff --git a/Documentation/rev-list-options.txt b/Documentation/rev-list-options.txt\nindex 966276b..85ee03e 100644\n--- a/Documentation/rev-list-options.txt\n+++ b/Documentation/rev-list-options.txt\n@@ -507,6 +507,21 @@ may not compile for example).\n This option can be used along with `--bisect-vars`, in this case,\n after all the sorted commit objects, there will be the same text as if\n `--bisect-vars` had been used alone.\n+\n+--bisect-replace::\n+\n+This option will make use of the \"bisect-replace-*\" branches if any,\n+but will not perform other bisection calculation.\n+\n+The purpose of the \"bisect-replace-*\" branches is to be grafted into\n+other branches when bisecting, so that bisection can be performed on\n+a fixed up history.\n+\n+The other `--bisect*` options use the \"bisect-replace-*\" branches by\n+default when they perform their bisection calculations. With the\n+\"--bisect-replace\" option, you can see what is the result of using the\n+\"bisect-replace-*\" branches without the effects of other bisection\n+calculations.\n endif::git-rev-list[]\n \n \ndiff --git a/builtin-rev-list.c b/builtin-rev-list.c\nindex c0717f6..75cc1fc 100644\n--- a/builtin-rev-list.c\n+++ b/builtin-rev-list.c\n@@ -47,12 +47,14 @@ static const char rev_list_usage[] =\n \"  special purpose:\\n\"\n \"    --bisect\\n\"\n \"    --bisect-vars\\n\"\n-\"    --bisect-all\"\n+\"    --bisect-all\\n\"\n+\"    --bisect-replace\"\n ;\n \n static struct rev_info revs;\n \n static int bisect_list;\n+static int bisect_replace_only;\n static int show_timestamp;\n static int hdr_termination;\n static const char *header_prefix;\n@@ -681,6 +683,10 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)\n \t\t\tbisect_show_vars = 1;\n \t\t\tcontinue;\n \t\t}\n+\t\tif (!strcmp(arg, \"--bisect-replace\")) {\n+\t\t\tbisect_replace_only = 1;\n+\t\t\tcontinue;\n+\t\t}\n \t\tif (!strcmp(arg, \"--stdin\")) {\n \t\t\tif (read_from_stdin++)\n \t\t\t\tdie(\"--stdin given twice?\");\n@@ -713,10 +719,10 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)\n \tsave_commit_buffer = revs.verbose_header ||\n \t\trevs.grep_filter.pattern_list;\n \n-\tif (bisect_list) {\n+\tif (bisect_list || bisect_replace_only)\n \t\tbisect_replace_all();\n+\tif (bisect_list)\n \t\trevs.limited = 1;\n-\t}\n \n \tif (prepare_revision_walk(&revs))\n \t\tdie(\"revision walk setup failed\");\ndiff --git a/t/t6035-bisect-replace.sh b/t/t6035-bisect-replace.sh\nindex 6ab3667..bc07206 100755\n--- a/t/t6035-bisect-replace.sh\n+++ b/t/t6035-bisect-replace.sh\n@@ -125,6 +125,18 @@ test_expect_success 'standard bisect works' '\n      git bisect reset\n '\n \n+test_expect_success '\"git rev-list --bisect-replace\" works' '\n+     echo \"$HASH7\" >> rev_list.expect &&\n+     echo \"$HASH6\" >> rev_list.expect &&\n+     echo \"$HASH5\" >> rev_list.expect &&\n+     echo \"$HASHFIX4\" >> rev_list.expect &&\n+     echo \"$HASHFIX3\" >> rev_list.expect &&\n+     echo \"$HASHFIX2\" >> rev_list.expect &&\n+     echo \"$HASH1\" >> rev_list.expect &&\n+     git rev-list --bisect-replace $HASH7 > rev_list.output &&\n+     test_cmp rev_list.expect rev_list.output\n+'\n+\n #\n #\n test_done\n-- \n1.6.0.3.619.g9a6a\n"}]}