{"thread":{"id":"16451","subject":"[PATCH 4/9 v5] rev-list: add \"--bisect-replace\" to list revisions with fixed up history","startedAt":"2008-11-24T21:15:28Z","lastAt":"2008-11-24T21:15:28Z","messageCount":1,"participants":["Christian Couder"],"isPatch":true,"patchVersion":5,"patchTotal":9},"messages":[{"id":"96440","messageId":"20081124221528.69162e85.chriscool@tuxfamily.org","threadId":"16451","inReplyTo":null,"subject":"[PATCH 4/9 v5] rev-list: add \"--bisect-replace\" to list revisions with fixed up history","fromName":"Christian Couder","fromEmail":"chriscool@tuxfamily.org","sentAt":"2008-11-24T21:15:28Z","receivedAt":"2008-11-24T21:15:28Z","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\"refs/replace/bisect/*\" refs.\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 b9f6e4d..b35f9d8 100644\n--- a/Documentation/rev-list-options.txt\n+++ b/Documentation/rev-list-options.txt\n@@ -574,6 +574,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 \"refs/replace/bisect/*\" refs if any,\n+but will not perform other bisection calculation.\n+\n+The purpose of the \"refs/replace/bisect/*\" refs is to be grafted into\n+other branches when bisecting, so that bisection can be performed on a\n+fixed up history.\n+\n+The other `--bisect*` options use the \"refs/replace/bisect/*\" refs 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+\"refs/replace/bisect/*\" refs 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 8adf269..693023f 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.5.6.1.1657.g6a50\n"}]}