{"thread":{"id":"7492","subject":"[RFC/PATCH] Bisect: teach \"bisect start\" to optionally use one bad and many good revs.","startedAt":"2007-04-01T12:57:23Z","lastAt":"2007-04-17T05:07:10Z","messageCount":9,"participants":["Christian Couder","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"38468","messageId":"20070401145723.27e17177.chriscool@tuxfamily.org","threadId":"7492","inReplyTo":null,"subject":"[RFC/PATCH] Bisect: teach \"bisect start\" to optionally use one bad and many good revs.","fromName":"Christian Couder","fromEmail":"chriscool@tuxfamily.org","sentAt":"2007-04-01T12:57:23Z","receivedAt":"2007-04-01T12:57:23Z","isPatch":true,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"As Junio said:\n\n\"One bad commit is fundamentally needed for bisect to run,\nand if we beforehand know more good commits, we can narrow\nthe bisect space down without doing the whole tree checkout\nevery time we give good commits.  I think it may be a good\nidea to have:\n\n    git bisect start [$bad [$good1 $good2...]] [-- <paths>...]\n\nas a short-hand for this command sequence:\n\n    git bisect start\n    git bisect bad $bad\n    git bisect good $good1 $good2...\n\nThat would be a good script-shorterner, without limiting it to\nany specific use scenario.\"\n\nIn fact this patch implements:\n\n    git bisect start [<bad> [<good>...]] [--] [<pathspec>...]\n\nI think this is more backward compatible because older script\nprobably didn't used -- before <pathspec>...\n\nOn the other hand, there may be some confusion between revs\n(<bad> and <good>...) and <pathspec>... if -- is not used\nand if an invalid rev or a pathspec that looks like a rev is\ngiven.\n\nSigned-off-by: Christian Couder <chriscool@tuxfamily.org>\n---\n git-bisect.sh         |  105 ++++++++++++++++++++++++++++++++++++++-----------\n t/t6030-bisect-run.sh |   20 ++++++++-\n 2 files changed, 99 insertions(+), 26 deletions(-)\n\ndiff --git a/git-bisect.sh b/git-bisect.sh\nindex 11313a7..d5a13ee 100755\n--- a/git-bisect.sh\n+++ b/git-bisect.sh\n@@ -1,15 +1,24 @@\n #!/bin/sh\n \n USAGE='[start|bad|good|next|reset|visualize|replay|log|run]'\n-LONG_USAGE='git bisect start [<pathspec>]\treset bisect state and start bisection.\n-git bisect bad [<rev>]\t\tmark <rev> a known-bad revision.\n-git bisect good [<rev>...]\tmark <rev>... known-good revisions.\n-git bisect next\t\t\tfind next bisection to test and check it out.\n-git bisect reset [<branch>]\tfinish bisection search and go back to branch.\n-git bisect visualize            show bisect status in gitk.\n-git bisect replay <logfile>\treplay bisection log.\n-git bisect log\t\t\tshow bisect log.\n-git bisect run <cmd>... \tuse <cmd>... to automatically bisect.'\n+LONG_USAGE='git bisect start [<bad> [<good>...]] [--] [<pathspec>...]\n+        reset bisect state and start bisection.\n+git bisect bad [<rev>]\n+        mark <rev> a known-bad revision.\n+git bisect good [<rev>...]\n+        mark <rev>... known-good revisions.\n+git bisect next\n+        find next bisection to test and check it out.\n+git bisect reset [<branch>]\n+        finish bisection search and go back to branch.\n+git bisect visualize\n+        show bisect status in gitk.\n+git bisect replay <logfile>\n+        replay bisection log.\n+git bisect log\n+        show bisect log.\n+git bisect run <cmd>...\n+        use <cmd>... to automatically bisect.'\n \n . git-sh-setup\n require_work_tree\n@@ -70,14 +79,48 @@ bisect_start() {\n \t#\n \t# Get rid of any old bisect state\n \t#\n-\trm -f \"$GIT_DIR/refs/heads/bisect\"\n-\trm -rf \"$GIT_DIR/refs/bisect/\"\n+\tbisect_clean_state\n \tmkdir \"$GIT_DIR/refs/bisect\"\n+\n+\t#\n+\t# Check for one bad and then some good revisions.\n+\t#\n+\thas_double_dash=0\n+\tfor arg in \"$@\"; do\n+\t    case \"$arg\" in --) has_double_dash=1; break ;; esac\n+\tdone\n+\torig_args=\"$@\"\n+\tbad_seen=0\n+\twhile [ $# -gt 0 ]; do\n+\t    arg=\"$1\"\n+\t    case \"$arg\" in\n+\t    --)\n+\t        shift\n+\t\tbreak\n+\t\t;;\n+\t    *)\n+\t        rev=$(git-rev-parse --verify \"$arg^{commit}\" 2>/dev/null) || {\n+\t\t    test $has_double_dash -eq 1 &&\n+\t\t        die \"'$arg' does not appear to be a valid revision\"\n+\t\t    break\n+\t\t}\n+\t\tif [ $bad_seen -eq 0 ]; then\n+\t\t    bad_seen=1\n+\t\t    bisect_write_bad \"$rev\"\n+\t\telse\n+\t\t    bisect_write_good \"$rev\"\n+\t\tfi\n+\t        shift\n+\t\t;;\n+\t    esac\n+        done\n+\n+\tsq \"$@\" >\"$GIT_DIR/BISECT_NAMES\"\n \t{\n \t    printf \"git-bisect start\"\n-\t    sq \"$@\"\n-\t} >\"$GIT_DIR/BISECT_LOG\"\n-\tsq \"$@\" >\"$GIT_DIR/BISECT_NAMES\"\n+\t    sq \"$orig_args\"\n+\t} >>\"$GIT_DIR/BISECT_LOG\"\n+\tbisect_auto_next\n }\n \n bisect_bad() {\n@@ -90,12 +133,17 @@ bisect_bad() {\n \t*)\n \t\tusage ;;\n \tesac || exit\n-\techo \"$rev\" >\"$GIT_DIR/refs/bisect/bad\"\n-\techo \"# bad: \"$(git-show-branch $rev) >>\"$GIT_DIR/BISECT_LOG\"\n+\tbisect_write_bad \"$rev\"\n \techo \"git-bisect bad $rev\" >>\"$GIT_DIR/BISECT_LOG\"\n \tbisect_auto_next\n }\n \n+bisect_write_bad() {\n+\trev=\"$1\"\n+\techo \"$rev\" >\"$GIT_DIR/refs/bisect/bad\"\n+\techo \"# bad: \"$(git-show-branch $rev) >>\"$GIT_DIR/BISECT_LOG\"\n+}\n+\n bisect_good() {\n \tbisect_autostart\n         case \"$#\" in\n@@ -106,13 +154,19 @@ bisect_good() {\n \tfor rev in $revs\n \tdo\n \t\trev=$(git-rev-parse --verify \"$rev^{commit}\") || exit\n-\t\techo \"$rev\" >\"$GIT_DIR/refs/bisect/good-$rev\"\n-\t\techo \"# good: \"$(git-show-branch $rev) >>\"$GIT_DIR/BISECT_LOG\"\n+\t\tbisect_write_good \"$rev\"\n \t\techo \"git-bisect good $rev\" >>\"$GIT_DIR/BISECT_LOG\"\n+\n \tdone\n \tbisect_auto_next\n }\n \n+bisect_write_good() {\n+\trev=\"$1\"\n+\techo \"$rev\" >\"$GIT_DIR/refs/bisect/good-$rev\"\n+\techo \"# good: \"$(git-show-branch $rev) >>\"$GIT_DIR/BISECT_LOG\"\n+}\n+\n bisect_next_check() {\n \tnext_ok=no\n         test -f \"$GIT_DIR/refs/bisect/bad\" &&\n@@ -190,14 +244,19 @@ bisect_reset() {\n \t    usage ;;\n \tesac\n \tif git checkout \"$branch\"; then\n-\t\trm -fr \"$GIT_DIR/refs/bisect\"\n-\t\trm -f \"$GIT_DIR/refs/heads/bisect\" \"$GIT_DIR/head-name\"\n-\t\trm -f \"$GIT_DIR/BISECT_LOG\"\n-\t\trm -f \"$GIT_DIR/BISECT_NAMES\"\n-\t\trm -f \"$GIT_DIR/BISECT_RUN\"\n+\t\trm -f \"$GIT_DIR/head-name\"\n+\t\tbisect_clean_state\n \tfi\n }\n \n+bisect_clean_state() {\n+\trm -fr \"$GIT_DIR/refs/bisect\"\n+\trm -f \"$GIT_DIR/refs/heads/bisect\"\n+\trm -f \"$GIT_DIR/BISECT_LOG\"\n+\trm -f \"$GIT_DIR/BISECT_NAMES\"\n+\trm -f \"$GIT_DIR/BISECT_RUN\"\n+}\n+\n bisect_replay () {\n \ttest -r \"$1\" || {\n \t\techo >&2 \"cannot read $1 for replaying\"\ndiff --git a/t/t6030-bisect-run.sh b/t/t6030-bisect-run.sh\nindex 39c7228..455dc60 100755\n--- a/t/t6030-bisect-run.sh\n+++ b/t/t6030-bisect-run.sh\n@@ -40,8 +40,8 @@ test_expect_success \\\n # We want to automatically find the commit that\n # introduced \"Another\" into hello.\n test_expect_success \\\n-    'git bisect run simple case' \\\n-    'echo \"#!/bin/sh\" > test_script.sh &&\n+    '\"git bisect run\" simple case' \\\n+    'echo \"#\"\\!\"/bin/sh\" > test_script.sh &&\n      echo \"grep Another hello > /dev/null\" >> test_script.sh &&\n      echo \"test \\$? -ne 0\" >> test_script.sh &&\n      chmod +x test_script.sh &&\n@@ -49,7 +49,21 @@ test_expect_success \\\n      git bisect good $HASH1 &&\n      git bisect bad $HASH4 &&\n      git bisect run ./test_script.sh > my_bisect_log.txt &&\n-     grep \"$HASH3 is first bad commit\" my_bisect_log.txt'\n+     grep \"$HASH3 is first bad commit\" my_bisect_log.txt &&\n+     git bisect reset'\n+\n+# We want to automatically find the commit that\n+# introduced \"Ciao\" into hello.\n+test_expect_success \\\n+    '\"git bisect run\" with more complex \"git bisect start\"' \\\n+    'echo \"#\"\\!\"/bin/sh\" > test_script.sh &&\n+     echo \"grep Ciao hello > /dev/null\" >> test_script.sh &&\n+     echo \"test \\$? -ne 0\" >> test_script.sh &&\n+     chmod +x test_script.sh &&\n+     git bisect start $HASH4 $HASH1 &&\n+     git bisect run ./test_script.sh > my_bisect_log.txt &&\n+     grep \"$HASH4 is first bad commit\" my_bisect_log.txt &&\n+     git bisect reset'\n \n #\n #\n-- \n1.5.1.rc3.21.g177f7-dirty\n"},{"id":"38529","messageId":"7vzm5pw7ju.fsf@assigned-by-dhcp.cox.net","threadId":"7492","inReplyTo":"20070401145723.27e17177.chriscool@tuxfamily.org","subject":"Re: [RFC/PATCH] Bisect: teach \"bisect start\" to optionally use one bad and many good revs.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-04-03T20:02:13Z","receivedAt":"2007-04-03T20:02:13Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Christian Couder <chriscool@tuxfamily.org> writes:\n\n> In fact this patch implements:\n>\n>     git bisect start [<bad> [<good>...]] [--] [<pathspec>...]\n>\n> I think this is more backward compatible because older script\n> probably didn't used -- before <pathspec>...\n>\n> On the other hand, there may be some confusion between revs\n> (<bad> and <good>...) and <pathspec>... if -- is not used\n> and if an invalid rev or a pathspec that looks like a rev is\n> given.\n\nI think the intent of the check you have for '--' to cover the\nabove issue is good.\n\n>\n> Signed-off-by: Christian Couder <chriscool@tuxfamily.org>\n> ---\n>  git-bisect.sh         |  105 ++++++++++++++++++++++++++++++++++++++-----------\n>  t/t6030-bisect-run.sh |   20 ++++++++-\n>  2 files changed, 99 insertions(+), 26 deletions(-)\n>\n> diff --git a/git-bisect.sh b/git-bisect.sh\n> index 11313a7..d5a13ee 100755\n> --- a/git-bisect.sh\n> +++ b/git-bisect.sh\n> @@ -1,15 +1,24 @@\n>  #!/bin/sh\n>  \n>  USAGE='[start|bad|good|next|reset|visualize|replay|log|run]'\n> -LONG_USAGE='git bisect start [<pathspec>]\treset bisect state and start bisection.\n> -git bisect bad [<rev>]\t\tmark <rev> a known-bad revision.\n> -git bisect good [<rev>...]\tmark <rev>... known-good revisions.\n> -git bisect next\t\t\tfind next bisection to test and check it out.\n> -git bisect reset [<branch>]\tfinish bisection search and go back to branch.\n> -git bisect visualize            show bisect status in gitk.\n> -git bisect replay <logfile>\treplay bisection log.\n> -git bisect log\t\t\tshow bisect log.\n> -git bisect run <cmd>... \tuse <cmd>... to automatically bisect.'\n> +LONG_USAGE='git bisect start [<bad> [<good>...]] [--] [<pathspec>...]\n> +        reset bisect state and start bisection.\n> +git bisect bad [<rev>]\n> +        mark <rev> a known-bad revision.\n> +git bisect good [<rev>...]\n> +        mark <rev>... known-good revisions.\n> +git bisect next\n> +        find next bisection to test and check it out.\n> +git bisect reset [<branch>]\n> +        finish bisection search and go back to branch.\n> +git bisect visualize\n> +        show bisect status in gitk.\n> +git bisect replay <logfile>\n> +        replay bisection log.\n> +git bisect log\n> +        show bisect log.\n> +git bisect run <cmd>...\n> +        use <cmd>... to automatically bisect.'\n\nMuch easier to read ;-).\n\n>  \tmkdir \"$GIT_DIR/refs/bisect\"\n> +\n> +\t#\n> +\t# Check for one bad and then some good revisions.\n> +\t#\n> +\thas_double_dash=0\n> +\tfor arg in \"$@\"; do\n> +\t    case \"$arg\" in --) has_double_dash=1; break ;; esac\n> +\tdone\n\nStyle.  'in \"$@\"' is superfluous.\n\n\tfor arg\n        do\n        \t...\n\tdone\n\n> +\torig_args=\"$@\"\n\nDoesn't this defeat the whole point of later running 'sq' on it?\nThe reason we do sq is to protect whitespaces in pathspecs and\nmake the strings correctly split when evaled/sourced.\n\nA simple test program:\n\n        #!/bin/sh\n        sq () {\n                echo \"** fake sq $* **\"\n                i=0\n                for j\n                do\n                        echo \"$i: <$j>\"\n                        i=$(( $i + 1 ))\n                done\n                echo\n        }\n\n        set x a 'b c' d\n        shift\n        # Now, $# = 3, $1 = 'a', $2 = 'b c' and $3 = 'd'\n        orig_args=\"$@\"\n        sq \"$@\"\n        sq \"$orig_args\"\n\n> ...\n> -\t    sq \"$@\"\n> -\t} >\"$GIT_DIR/BISECT_LOG\"\n> -\tsq \"$@\" >\"$GIT_DIR/BISECT_NAMES\"\n> +\t    sq \"$orig_args\"\n> +\t} >>\"$GIT_DIR/BISECT_LOG\"\n> +\tbisect_auto_next\n>  }\n"},{"id":"38585","messageId":"20070404071202.483030b8.chriscool@tuxfamily.org","threadId":"7492","inReplyTo":"7vzm5pw7ju.fsf@assigned-by-dhcp.cox.net","subject":"[PATCH] Bisect: teach \"bisect start\" to optionally use one bad and many good revs.","fromName":"Christian Couder","fromEmail":"chriscool@tuxfamily.org","sentAt":"2007-04-04T05:12:02Z","receivedAt":"2007-04-04T05:12:02Z","isPatch":true,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"As Junio said:\n\n\"One bad commit is fundamentally needed for bisect to run,\nand if we beforehand know more good commits, we can narrow\nthe bisect space down without doing the whole tree checkout\nevery time we give good commits.  I think it may be a good\nidea to have:\n\n    git bisect start [$bad [$good1 $good2...]] [-- <paths>...]\n\nas a short-hand for this command sequence:\n\n    git bisect start\n    git bisect bad $bad\n    git bisect good $good1 $good2...\n\nThat would be a good script-shorterner, without limiting it to\nany specific use scenario.\"\n\nIn fact this patch implements:\n\n    git bisect start [<bad> [<good>...]] [--] [<pathspec>...]\n\nI think this is more backward compatible because older script\nprobably didn't used -- before <pathspec>...\n\nOn the other hand, there may be some confusion between revs\n(<bad> and <good>...) and <pathspec>... if -- is not used\nand if an invalid rev or a pathspec that looks like a rev is\ngiven.\n\nSigned-off-by: Christian Couder <chriscool@tuxfamily.org>\n---\n\nJunio wrote:\n\n> > +\tfor arg in \"$@\"; do\n> > +\t    case \"$arg\" in --) has_double_dash=1; break ;; esac\n> > +\tdone\n>\n> Style.  'in \"$@\"' is superfluous.\n\nFixed in this patch.\n\n> > +\torig_args=\"$@\"\n>\n> Doesn't this defeat the whole point of later running 'sq' on it?\n> The reason we do sq is to protect whitespaces in pathspecs and\n> make the strings correctly split when evaled/sourced.\n\nThis should also be fixed.\n\nThanks,\nChristian.\n\n\n git-bisect.sh         |  105 ++++++++++++++++++++++++++++++++++++++-----------\n t/t6030-bisect-run.sh |   20 ++++++++-\n 2 files changed, 99 insertions(+), 26 deletions(-)\n\ndiff --git a/git-bisect.sh b/git-bisect.sh\nindex 11313a7..2e68e3d 100755\n--- a/git-bisect.sh\n+++ b/git-bisect.sh\n@@ -1,15 +1,24 @@\n #!/bin/sh\n \n USAGE='[start|bad|good|next|reset|visualize|replay|log|run]'\n-LONG_USAGE='git bisect start [<pathspec>]\treset bisect state and start bisection.\n-git bisect bad [<rev>]\t\tmark <rev> a known-bad revision.\n-git bisect good [<rev>...]\tmark <rev>... known-good revisions.\n-git bisect next\t\t\tfind next bisection to test and check it out.\n-git bisect reset [<branch>]\tfinish bisection search and go back to branch.\n-git bisect visualize            show bisect status in gitk.\n-git bisect replay <logfile>\treplay bisection log.\n-git bisect log\t\t\tshow bisect log.\n-git bisect run <cmd>... \tuse <cmd>... to automatically bisect.'\n+LONG_USAGE='git bisect start [<bad> [<good>...]] [--] [<pathspec>...]\n+        reset bisect state and start bisection.\n+git bisect bad [<rev>]\n+        mark <rev> a known-bad revision.\n+git bisect good [<rev>...]\n+        mark <rev>... known-good revisions.\n+git bisect next\n+        find next bisection to test and check it out.\n+git bisect reset [<branch>]\n+        finish bisection search and go back to branch.\n+git bisect visualize\n+        show bisect status in gitk.\n+git bisect replay <logfile>\n+        replay bisection log.\n+git bisect log\n+        show bisect log.\n+git bisect run <cmd>...\n+        use <cmd>... to automatically bisect.'\n \n . git-sh-setup\n require_work_tree\n@@ -70,14 +79,48 @@ bisect_start() {\n \t#\n \t# Get rid of any old bisect state\n \t#\n-\trm -f \"$GIT_DIR/refs/heads/bisect\"\n-\trm -rf \"$GIT_DIR/refs/bisect/\"\n+\tbisect_clean_state\n \tmkdir \"$GIT_DIR/refs/bisect\"\n+\n+\t#\n+\t# Check for one bad and then some good revisions.\n+\t#\n+\thas_double_dash=0\n+\tfor arg; do\n+\t    case \"$arg\" in --) has_double_dash=1; break ;; esac\n+\tdone\n+\torig_args=$(sq \"$@\")\n+\tbad_seen=0\n+\twhile [ $# -gt 0 ]; do\n+\t    arg=\"$1\"\n+\t    case \"$arg\" in\n+\t    --)\n+\t        shift\n+\t\tbreak\n+\t\t;;\n+\t    *)\n+\t        rev=$(git-rev-parse --verify \"$arg^{commit}\" 2>/dev/null) || {\n+\t\t    test $has_double_dash -eq 1 &&\n+\t\t        die \"'$arg' does not appear to be a valid revision\"\n+\t\t    break\n+\t\t}\n+\t\tif [ $bad_seen -eq 0 ]; then\n+\t\t    bad_seen=1\n+\t\t    bisect_write_bad \"$rev\"\n+\t\telse\n+\t\t    bisect_write_good \"$rev\"\n+\t\tfi\n+\t        shift\n+\t\t;;\n+\t    esac\n+        done\n+\n+\tsq \"$@\" >\"$GIT_DIR/BISECT_NAMES\"\n \t{\n \t    printf \"git-bisect start\"\n-\t    sq \"$@\"\n-\t} >\"$GIT_DIR/BISECT_LOG\"\n-\tsq \"$@\" >\"$GIT_DIR/BISECT_NAMES\"\n+\t    echo \"$orig_args\"\n+\t} >>\"$GIT_DIR/BISECT_LOG\"\n+\tbisect_auto_next\n }\n \n bisect_bad() {\n@@ -90,12 +133,17 @@ bisect_bad() {\n \t*)\n \t\tusage ;;\n \tesac || exit\n-\techo \"$rev\" >\"$GIT_DIR/refs/bisect/bad\"\n-\techo \"# bad: \"$(git-show-branch $rev) >>\"$GIT_DIR/BISECT_LOG\"\n+\tbisect_write_bad \"$rev\"\n \techo \"git-bisect bad $rev\" >>\"$GIT_DIR/BISECT_LOG\"\n \tbisect_auto_next\n }\n \n+bisect_write_bad() {\n+\trev=\"$1\"\n+\techo \"$rev\" >\"$GIT_DIR/refs/bisect/bad\"\n+\techo \"# bad: \"$(git-show-branch $rev) >>\"$GIT_DIR/BISECT_LOG\"\n+}\n+\n bisect_good() {\n \tbisect_autostart\n         case \"$#\" in\n@@ -106,13 +154,19 @@ bisect_good() {\n \tfor rev in $revs\n \tdo\n \t\trev=$(git-rev-parse --verify \"$rev^{commit}\") || exit\n-\t\techo \"$rev\" >\"$GIT_DIR/refs/bisect/good-$rev\"\n-\t\techo \"# good: \"$(git-show-branch $rev) >>\"$GIT_DIR/BISECT_LOG\"\n+\t\tbisect_write_good \"$rev\"\n \t\techo \"git-bisect good $rev\" >>\"$GIT_DIR/BISECT_LOG\"\n+\n \tdone\n \tbisect_auto_next\n }\n \n+bisect_write_good() {\n+\trev=\"$1\"\n+\techo \"$rev\" >\"$GIT_DIR/refs/bisect/good-$rev\"\n+\techo \"# good: \"$(git-show-branch $rev) >>\"$GIT_DIR/BISECT_LOG\"\n+}\n+\n bisect_next_check() {\n \tnext_ok=no\n         test -f \"$GIT_DIR/refs/bisect/bad\" &&\n@@ -190,14 +244,19 @@ bisect_reset() {\n \t    usage ;;\n \tesac\n \tif git checkout \"$branch\"; then\n-\t\trm -fr \"$GIT_DIR/refs/bisect\"\n-\t\trm -f \"$GIT_DIR/refs/heads/bisect\" \"$GIT_DIR/head-name\"\n-\t\trm -f \"$GIT_DIR/BISECT_LOG\"\n-\t\trm -f \"$GIT_DIR/BISECT_NAMES\"\n-\t\trm -f \"$GIT_DIR/BISECT_RUN\"\n+\t\trm -f \"$GIT_DIR/head-name\"\n+\t\tbisect_clean_state\n \tfi\n }\n \n+bisect_clean_state() {\n+\trm -fr \"$GIT_DIR/refs/bisect\"\n+\trm -f \"$GIT_DIR/refs/heads/bisect\"\n+\trm -f \"$GIT_DIR/BISECT_LOG\"\n+\trm -f \"$GIT_DIR/BISECT_NAMES\"\n+\trm -f \"$GIT_DIR/BISECT_RUN\"\n+}\n+\n bisect_replay () {\n \ttest -r \"$1\" || {\n \t\techo >&2 \"cannot read $1 for replaying\"\ndiff --git a/t/t6030-bisect-run.sh b/t/t6030-bisect-run.sh\nindex 39c7228..455dc60 100755\n--- a/t/t6030-bisect-run.sh\n+++ b/t/t6030-bisect-run.sh\n@@ -40,8 +40,8 @@ test_expect_success \\\n # We want to automatically find the commit that\n # introduced \"Another\" into hello.\n test_expect_success \\\n-    'git bisect run simple case' \\\n-    'echo \"#!/bin/sh\" > test_script.sh &&\n+    '\"git bisect run\" simple case' \\\n+    'echo \"#\"\\!\"/bin/sh\" > test_script.sh &&\n      echo \"grep Another hello > /dev/null\" >> test_script.sh &&\n      echo \"test \\$? -ne 0\" >> test_script.sh &&\n      chmod +x test_script.sh &&\n@@ -49,7 +49,21 @@ test_expect_success \\\n      git bisect good $HASH1 &&\n      git bisect bad $HASH4 &&\n      git bisect run ./test_script.sh > my_bisect_log.txt &&\n-     grep \"$HASH3 is first bad commit\" my_bisect_log.txt'\n+     grep \"$HASH3 is first bad commit\" my_bisect_log.txt &&\n+     git bisect reset'\n+\n+# We want to automatically find the commit that\n+# introduced \"Ciao\" into hello.\n+test_expect_success \\\n+    '\"git bisect run\" with more complex \"git bisect start\"' \\\n+    'echo \"#\"\\!\"/bin/sh\" > test_script.sh &&\n+     echo \"grep Ciao hello > /dev/null\" >> test_script.sh &&\n+     echo \"test \\$? -ne 0\" >> test_script.sh &&\n+     chmod +x test_script.sh &&\n+     git bisect start $HASH4 $HASH1 &&\n+     git bisect run ./test_script.sh > my_bisect_log.txt &&\n+     grep \"$HASH4 is first bad commit\" my_bisect_log.txt &&\n+     git bisect reset'\n \n #\n #\n-- \n1.5.1.rc3.21.g02918\n"},{"id":"38669","messageId":"20070405053353.f4cebf57.chriscool@tuxfamily.org","threadId":"7492","inReplyTo":"20070404071202.483030b8.chriscool@tuxfamily.org","subject":"[PATCH] Documentation: bisect: \"start\" accepts one bad and many good commits","fromName":"Christian Couder","fromEmail":"chriscool@tuxfamily.org","sentAt":"2007-04-05T03:33:53Z","receivedAt":"2007-04-05T03:33:53Z","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-bisect.txt |   19 +++++++++++++++----\n 1 files changed, 15 insertions(+), 4 deletions(-)\n\ndiff --git a/Documentation/git-bisect.txt b/Documentation/git-bisect.txt\nindex b2bc58d..5f68ee1 100644\n--- a/Documentation/git-bisect.txt\n+++ b/Documentation/git-bisect.txt\n@@ -15,7 +15,7 @@ DESCRIPTION\n The command takes various subcommands, and different options depending\n on the subcommand:\n \n- git bisect start [<paths>...]\n+ git bisect start [<bad> [<good>...]] [--] [<paths>...]\n  git bisect bad <rev>\n  git bisect good <rev>\n  git bisect reset [<branch>]\n@@ -134,15 +134,26 @@ $ git reset --hard HEAD~3\t\t# try 3 revs before what\n Then compile and test the one you chose to try. After that, tell\n bisect what the result was as usual.\n \n-Cutting down bisection by giving path parameter to bisect start\n-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n+Cutting down bisection by giving more parameters to bisect start\n+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n \n You can further cut down the number of trials if you know what part of\n the tree is involved in the problem you are tracking down, by giving\n paths parameters when you say `bisect start`, like this:\n \n ------------\n-$ git bisect start arch/i386 include/asm-i386\n+$ git bisect start -- arch/i386 include/asm-i386\n+------------\n+\n+If you know beforehand more than one good commits, you can narrow the\n+bisect space down without doing the whole tree checkout every time you\n+give good commits. You give the bad revision immediately after `start`\n+and then you give all the good revisions you have:\n+\n+------------\n+$ git bisect start v2.6.20-rc6 v2.6.20-rc4 v2.6.20-rc1 --\n+                   # v2.6.20-rc6 is bad\n+                   # v2.6.20-rc4 and v2.6.20-rc1 are good\n ------------\n \n Bisect run\n-- \n1.5.1.rc3.21.g02918\n"},{"id":"38670","messageId":"7vejmzxvwk.fsf@assigned-by-dhcp.cox.net","threadId":"7492","inReplyTo":"20070405053353.f4cebf57.chriscool@tuxfamily.org","subject":"Re: [PATCH] Documentation: bisect: \"start\" accepts one bad and many good commits","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-04-05T04:55:23Z","receivedAt":"2007-04-05T04:55:23Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Christian Couder <chriscool@tuxfamily.org> writes:\n\n> Signed-off-by: Christian Couder <chriscool@tuxfamily.org>\n\nThanks.\n\n> +If you know beforehand more than one good commits, you can narrow the\n> +bisect space down without doing the whole tree checkout every time you\n> +give good commits. You give the bad revision immediately after `start`\n> +and then you give all the good revisions you have:\n> +\n> +------------\n> +$ git bisect start v2.6.20-rc6 v2.6.20-rc4 v2.6.20-rc1 --\n> +                   # v2.6.20-rc6 is bad\n> +                   # v2.6.20-rc4 and v2.6.20-rc1 are good\n>  ------------\n\nWe would probably want mnemonic to help people remember the\norder of parameters: Bad comes before Good, simply because B\nsorts earlier than G.\n"},{"id":"38780","messageId":"7v7isqkoa3.fsf_-_@assigned-by-dhcp.cox.net","threadId":"7492","inReplyTo":"20070404071202.483030b8.chriscool@tuxfamily.org","subject":"[PATCH 2/2] git-bisect: allow bisecting with only one bad commit.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-04-06T06:30:44Z","receivedAt":"2007-04-06T06:30:44Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"This allows you to say:\n\n\tgit bisect start\n\tgit bisect bad $bad\n\tgit bisect next\n\nto start bisection without knowing a good commit.  This would\nhave you try a commit that is half-way since the beginning of\nthe history, which is rather wasteful if you already know a good\ncommit, but if you don't (or your history is short enough that\nyou do not care), there is no reason not to allow this.\n\nSigned-off-by: Junio C Hamano <junkio@cox.net>\n---\n\n * These two are on top of your \"bisect start [B [G G...] [--] [paths...]\".\n\n git-bisect.sh         |   87 ++++++++++++++++++++++++++++++-------------------\n t/t6030-bisect-run.sh |   17 +++------\n 2 files changed, 59 insertions(+), 45 deletions(-)\n\ndiff --git a/git-bisect.sh b/git-bisect.sh\nindex c936533..85c374e 100755\n--- a/git-bisect.sh\n+++ b/git-bisect.sh\n@@ -168,26 +168,40 @@ bisect_write_good() {\n }\n \n bisect_next_check() {\n-\tnext_ok=no\n-\tgit show-ref -q --verify refs/bisect/bad &&\n-\ttest -n \"$(git for-each-ref \"refs/bisect/good-*\")\" &&\n-\tnext_ok=yes\n-\n-\tcase \"$next_ok,$1\" in\n-\tno,) false ;;\n-\tno,fail)\n-\t    THEN=''\n-\t    test -d \"$GIT_DIR/refs/bisect\" || {\n-\t\techo >&2 'You need to start by \"git bisect start\".'\n-\t\tTHEN='then '\n-\t    }\n-\t    echo >&2 'You '$THEN'need to give me at least one good' \\\n-\t\t'and one bad revisions.'\n-\t    echo >&2 '(You can use \"git bisect bad\" and' \\\n-\t\t'\"git bisect good\" for that.)'\n-\t    exit 1 ;;\n+\tmissing_good= missing_bad=\n+\tgit show-ref -q --verify refs/bisect/bad || missing_bad=t\n+\ttest -n \"$(git for-each-ref \"refs/bisect/good-*\")\" || missing_good=t\n+\n+\tcase \"$missing_good,$missing_bad,$1\" in\n+\t,,*)\n+\t\t: have both good and bad - ok\n+\t\t;;\n+\t*,)\n+\t\t# do not have both but not asked to fail - just report.\n+\t\tfalse\n+\t\t;;\n+\tt,,good)\n+\t\t# have bad but not good.  we could bisect although\n+\t\t# this is less optimum.\n+\t\techo >&2 'Warning: bisecting only with a bad commit.'\n+\t\tif test -t 0\n+\t\tthen\n+\t\t\tprintf >&2 'Are you sure [Y/n]? '\n+\t\t\tcase \"$(read yesno)\" in [Nn]*) exit 1 ;; esac\n+\t\tfi\n+\t\t: bisect without good...\n+\t\t;;\n \t*)\n-\t    true ;;\n+\t\tTHEN=''\n+\t\ttest -d \"$GIT_DIR/refs/bisect\" || {\n+\t\t\techo >&2 'You need to start by \"git bisect start\".'\n+\t\t\tTHEN='then '\n+\t\t}\n+\t\techo >&2 'You '$THEN'need to give me at least one good' \\\n+\t\t\t'and one bad revisions.'\n+\t\techo >&2 '(You can use \"git bisect bad\" and' \\\n+\t\t\t'\"git bisect good\" for that.)'\n+\t\texit 1 ;;\n \tesac\n }\n \n@@ -198,27 +212,32 @@ bisect_auto_next() {\n bisect_next() {\n         case \"$#\" in 0) ;; *) usage ;; esac\n \tbisect_autostart\n-\tbisect_next_check fail\n+\tbisect_next_check good\n+\n \tbad=$(git-rev-parse --verify refs/bisect/bad) &&\n-\tgood=$(git-rev-parse --sq --revs-only --not \\\n-\t\t$(cd \"$GIT_DIR\" && ls refs/bisect/good-*)) &&\n-\trev=$(eval \"git-rev-list --bisect $good $bad -- $(cat \"$GIT_DIR/BISECT_NAMES\")\") || exit\n-\tif [ -z \"$rev\" ]; then\n-\t    echo \"$bad was both good and bad\"\n-\t    exit 1\n+\tgood=$(git for-each-ref --format='^%(objectname)' \\\n+\t\t\"refs/bisect/good-*\" | tr '[\\012]' ' ') &&\n+\teval=\"git-rev-list --bisect-vars $good $bad --\" &&\n+\teval=\"$eval $(cat \"$GIT_DIR/BISECT_NAMES\")\" &&\n+\teval=$(eval \"$eval\") &&\n+\teval \"$eval\" || exit\n+\n+\tif [ -z \"$bisect_rev\" ]; then\n+\t\techo \"$bad was both good and bad\"\n+\t\texit 1\n \tfi\n-\tif [ \"$rev\" = \"$bad\" ]; then\n-\t    echo \"$rev is first bad commit\"\n-\t    git-diff-tree --pretty $rev\n-\t    exit 0\n+\tif [ \"$bisect_rev\" = \"$bad\" ]; then\n+\t\techo \"$bisect_rev is first bad commit\"\n+\t\tgit-diff-tree --pretty $bisect_rev\n+\t\texit 0\n \tfi\n-\tnr=$(eval \"git-rev-list $rev $good -- $(cat $GIT_DIR/BISECT_NAMES)\" | wc -l) || exit\n-\techo \"Bisecting: $nr revisions left to test after this\"\n-\techo \"$rev\" > \"$GIT_DIR/refs/heads/new-bisect\"\n+\n+\techo \"Bisecting: $bisect_nr revisions left to test after this\"\n+\techo \"$bisect_rev\" >\"$GIT_DIR/refs/heads/new-bisect\"\n \tgit checkout -q new-bisect || exit\n \tmv \"$GIT_DIR/refs/heads/new-bisect\" \"$GIT_DIR/refs/heads/bisect\" &&\n \tGIT_DIR=\"$GIT_DIR\" git-symbolic-ref HEAD refs/heads/bisect\n-\tgit-show-branch \"$rev\"\n+\tgit-show-branch \"$bisect_rev\"\n }\n \n bisect_visualize() {\ndiff --git a/t/t6030-bisect-run.sh b/t/t6030-bisect-run.sh\nindex 1c38f08..7f41807 100755\n--- a/t/t6030-bisect-run.sh\n+++ b/t/t6030-bisect-run.sh\n@@ -4,6 +4,8 @@\n #\n test_description='Tests git-bisect run functionality'\n \n+exec </dev/null\n+\n . ./test-lib.sh\n \n add_line_into_file()\n@@ -37,21 +39,14 @@ test_expect_success \\\n      HASH3=$(git rev-list HEAD | head -2 | tail -1) &&\n      HASH4=$(git rev-list HEAD | head -1)'\n \n-test_expect_success 'bisect does not start with only one bad' '\n+test_expect_success 'bisect starts with only one bad' '\n \tgit bisect reset &&\n \tgit bisect start &&\n-\tgit bisect bad $HASH4 || return 1\n-\n-\tif git bisect next\n-\tthen\n-\t\techo Oops, should have failed.\n-\t\tfalse\n-\telse\n-\t\t:\n-\tfi\n+\tgit bisect bad $HASH4 &&\n+\tgit bisect next\n '\n \n-test_expect_success 'bisect does not start with only one good' '\n+test_expect_success 'bisect starts with only one good' '\n \tgit bisect reset &&\n \tgit bisect start &&\n \tgit bisect good $HASH1 || return 1\n-- \n1.5.1.53.g77e6f\n"},{"id":"38781","messageId":"7v648ako9x.fsf_-_@assigned-by-dhcp.cox.net","threadId":"7492","inReplyTo":"20070404071202.483030b8.chriscool@tuxfamily.org","subject":"[PATCH 1/2] t6030: add a bit more tests to git-bisect","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-04-06T06:30:50Z","receivedAt":"2007-04-06T06:30:50Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Verify that git-bisect does not start before getting one bad and\none good commit.\n\nSigned-off-by: Junio C Hamano <junkio@cox.net>\n---\n t/t6030-bisect-run.sh |   36 ++++++++++++++++++++++++++++++++++++\n 1 files changed, 36 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t6030-bisect-run.sh b/t/t6030-bisect-run.sh\nindex 455dc60..1c38f08 100755\n--- a/t/t6030-bisect-run.sh\n+++ b/t/t6030-bisect-run.sh\n@@ -37,6 +37,42 @@ test_expect_success \\\n      HASH3=$(git rev-list HEAD | head -2 | tail -1) &&\n      HASH4=$(git rev-list HEAD | head -1)'\n \n+test_expect_success 'bisect does not start with only one bad' '\n+\tgit bisect reset &&\n+\tgit bisect start &&\n+\tgit bisect bad $HASH4 || return 1\n+\n+\tif git bisect next\n+\tthen\n+\t\techo Oops, should have failed.\n+\t\tfalse\n+\telse\n+\t\t:\n+\tfi\n+'\n+\n+test_expect_success 'bisect does not start with only one good' '\n+\tgit bisect reset &&\n+\tgit bisect start &&\n+\tgit bisect good $HASH1 || return 1\n+\n+\tif git bisect next\n+\tthen\n+\t\techo Oops, should have failed.\n+\t\tfalse\n+\telse\n+\t\t:\n+\tfi\n+'\n+\n+test_expect_success 'bisect start with one bad and good' '\n+\tgit bisect reset &&\n+\tgit bisect start &&\n+\tgit bisect good $HASH1 &&\n+\tgit bisect bad $HASH4 &&\n+\tgit bisect next\n+'\n+\n # We want to automatically find the commit that\n # introduced \"Another\" into hello.\n test_expect_success \\\n-- \n1.5.1.53.g77e6f\n"},{"id":"39604","messageId":"7v7isbsibn.fsf@assigned-by-dhcp.cox.net","threadId":"7492","inReplyTo":"200704170707.10938.chriscool@tuxfamily.org","subject":"Re: [PATCH 2/2] git-bisect: allow bisecting with only one bad commit.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-04-17T05:03:56Z","receivedAt":"2007-04-17T05:03:56Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Christian Couder <chriscool@tuxfamily.org> writes:\n\n>> -test_expect_success 'bisect does not start with only one good' '\n>> +test_expect_success 'bisect starts with only one good' '\n>>  \tgit bisect reset &&\n>>  \tgit bisect start &&\n>>  \tgit bisect good $HASH1 || return 1\n>\n> But I don't understand the need to change the above comment when the test \n> code for starting with one good commit is not changed.\n\nGood eyes, thanks.\n"},{"id":"39603","messageId":"200704170707.10938.chriscool@tuxfamily.org","threadId":"7492","inReplyTo":"7v7isqkoa3.fsf_-_@assigned-by-dhcp.cox.net","subject":"Re: [PATCH 2/2] git-bisect: allow bisecting with only one bad commit.","fromName":"Christian Couder","fromEmail":"chriscool@tuxfamily.org","sentAt":"2007-04-17T05:07:10Z","receivedAt":"2007-04-17T05:07:10Z","isPatch":true,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"Hi Junio,\n\nYou wrote:\n\n[...]\n> -test_expect_success 'bisect does not start with only one bad' '\n> +test_expect_success 'bisect starts with only one bad' '\n>  \tgit bisect reset &&\n>  \tgit bisect start &&\n> -\tgit bisect bad $HASH4 || return 1\n> -\n> -\tif git bisect next\n> -\tthen\n> -\t\techo Oops, should have failed.\n> -\t\tfalse\n> -\telse\n> -\t\t:\n> -\tfi\n> +\tgit bisect bad $HASH4 &&\n> +\tgit bisect next\n>  '\n\nOk, this is the purpose of your patch to make the above work.\n\n> -test_expect_success 'bisect does not start with only one good' '\n> +test_expect_success 'bisect starts with only one good' '\n>  \tgit bisect reset &&\n>  \tgit bisect start &&\n>  \tgit bisect good $HASH1 || return 1\n\nBut I don't understand the need to change the above comment when the test \ncode for starting with one good commit is not changed.\n\nThanks,\nChristian.\n"}]}