{"thread":{"id":"16266","subject":"[PATCH 8/9 v4] rev-list: make it possible to disable replacing using \"--no-bisect-replace\"","startedAt":"2008-11-11T05:45:47Z","lastAt":"2008-11-11T05:45:47Z","messageCount":1,"participants":["Christian Couder"],"isPatch":true,"patchVersion":4,"patchTotal":9},"messages":[{"id":"95436","messageId":"20081111064547.b3a60ebb.chriscool@tuxfamily.org","threadId":"16266","inReplyTo":null,"subject":"[PATCH 8/9 v4] rev-list: make it possible to disable replacing using \"--no-bisect-replace\"","fromName":"Christian Couder","fromEmail":"chriscool@tuxfamily.org","sentAt":"2008-11-11T05:45:47Z","receivedAt":"2008-11-11T05:45:47Z","isPatch":true,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"Signed-off-by: Christian Couder <chriscool@tuxfamily.org>\n---\n Documentation/git-rev-list.txt     |    1 +\n Documentation/rev-list-options.txt |   10 ++++++++++\n builtin-rev-list.c                 |   20 ++++++++++++++++----\n t/t6035-bisect-replace.sh          |   10 ++++++++++\n 4 files changed, 37 insertions(+), 4 deletions(-)\n\ndiff --git a/Documentation/git-rev-list.txt b/Documentation/git-rev-list.txt\nindex 4cc8abf..b466da3 100644\n--- a/Documentation/git-rev-list.txt\n+++ b/Documentation/git-rev-list.txt\n@@ -42,6 +42,7 @@ SYNOPSIS\n \t     [ \\--bisect-vars ]\n \t     [ \\--bisect-all ]\n \t     [ \\--bisect-replace ]\n+\t     [ \\--no-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 36253b8..e207b4f 100644\n--- a/Documentation/rev-list-options.txt\n+++ b/Documentation/rev-list-options.txt\n@@ -522,6 +522,16 @@ 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+\n+--no-bisect-replace::\n+\n+With this option, 'rev-list' will not make use of the\n+\"bisect-replace-*\" branches, even if another `--bisect*` option is\n+used.\n+\n+By default, if any `--bisect*` option is used, 'rev-list' will graft\n+\"bisect-replace-*\" branches into other branches when bisecting, so\n+that bisection can be performed on a fixed up history.\n endif::git-rev-list[]\n \n \ndiff --git a/builtin-rev-list.c b/builtin-rev-list.c\nindex 7cf5f9e..65e59d6 100644\n--- a/builtin-rev-list.c\n+++ b/builtin-rev-list.c\n@@ -48,13 +48,20 @@ static const char rev_list_usage[] =\n \"    --bisect\\n\"\n \"    --bisect-vars\\n\"\n \"    --bisect-all\\n\"\n-\"    --bisect-replace\"\n+\"    --bisect-replace\\n\"\n+\"    --no-bisect-replace\"\n ;\n \n static struct rev_info revs;\n \n+enum {\n+\tREPLACE_UNSET,\n+\tREPLACE_DEFAULT,\n+\tREPLACE_SET\n+};\n+\n static int bisect_list;\n-static int bisect_replace_only;\n+static int bisect_force_replace = REPLACE_DEFAULT;\n static int show_timestamp;\n static int hdr_termination;\n static const char *header_prefix;\n@@ -684,7 +691,11 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)\n \t\t\tcontinue;\n \t\t}\n \t\tif (!strcmp(arg, \"--bisect-replace\")) {\n-\t\t\tbisect_replace_only = 1;\n+\t\t\tbisect_force_replace = REPLACE_SET;\n+\t\t\tcontinue;\n+\t\t}\n+\t\tif (!strcmp(arg, \"--no-bisect-replace\")) {\n+\t\t\tbisect_force_replace = REPLACE_UNSET;\n \t\t\tcontinue;\n \t\t}\n \t\tif (!strcmp(arg, \"--stdin\")) {\n@@ -719,7 +730,8 @@ 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 || bisect_replace_only)\n+\tif (bisect_force_replace != REPLACE_UNSET &&\n+\t    (bisect_list || bisect_force_replace == REPLACE_SET))\n \t\tbisect_replace_all();\n \tif (bisect_list)\n \t\trevs.limited = 1;\ndiff --git a/t/t6035-bisect-replace.sh b/t/t6035-bisect-replace.sh\nindex dabf1ae..f22a2e5 100755\n--- a/t/t6035-bisect-replace.sh\n+++ b/t/t6035-bisect-replace.sh\n@@ -154,6 +154,16 @@ test_expect_success 'git bisect works when starting on the replace branch' '\n      git bisect reset\n '\n \n+test_expect_success '\"git rev-list --no-bisect-replace\" works' '\n+     git rev-list --bisect-all --no-bisect-replace $HASH6 > rev_list.txt &&\n+     test_must_fail grep $HASHFIX2 rev_list.txt &&\n+     test_must_fail grep $HASHFIX3 rev_list.txt &&\n+     test_must_fail grep $HASHFIX4 rev_list.txt &&\n+     grep $HASH2 rev_list.txt &&\n+     grep $HASH3 rev_list.txt &&\n+     grep $HASH4 rev_list.txt\n+'\n+\n #\n #\n test_done\n-- \n1.6.0.3.614.g0f3b9\n"}]}