{"thread":{"id":"34708","subject":"[PATCH] Add command `git bisect state` that checks if the current bisection process has reached the first bad commit.","startedAt":"2013-08-15T22:35:12Z","lastAt":"2013-08-18T21:39:03Z","messageCount":4,"participants":["Mattias Andrée","Eric Sunshine","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"225298","messageId":"1376606112-1712-1-git-send-email-maandree@operamail.com","threadId":"34708","inReplyTo":null,"subject":"[PATCH] Add command `git bisect state` that checks if the current bisection process has reached the first bad commit.","fromName":"Mattias Andrée","fromEmail":"maandree@operamail.com","sentAt":"2013-08-15T22:35:12Z","receivedAt":"2013-08-15T22:35:12Z","isPatch":true,"sender":{"key":"maandree@operamail.com","avatar":"https://gravatar.com/avatar/58182a5da6d839d37e33254c574806ebda697c38f86cd37a482ccd60c487d141?d=mp&s=160"},"body":"This can be used for automated bisection without a check script.\n\nSigned-off-by: Mattias Andrée <maandree@operamail.com>\n---\n Documentation/git-bisect.txt | 13 +++++++++++++\n git-bisect.sh                | 11 ++++++++++-\n 2 files changed, 23 insertions(+), 1 deletion(-)\n\ndiff --git a/Documentation/git-bisect.txt b/Documentation/git-bisect.txt\nindex f986c5c..ca8c09d 100644\n--- a/Documentation/git-bisect.txt\n+++ b/Documentation/git-bisect.txt\n@@ -25,6 +25,7 @@ on the subcommand:\n  git bisect visualize\n  git bisect replay <logfile>\n  git bisect log\n+ git bisect state\n  git bisect run <cmd>...\n \n This command uses 'git rev-list --bisect' to help drive the\n@@ -104,6 +105,18 @@ For example, `git bisect reset HEAD` will leave you on the current\n bisection commit and avoid switching commits at all, while `git bisect\n reset bisect/bad` will check out the first bad revision.\n \n+Bisect state\n+~~~~~~~~~~~~~~~~\n+\n+To see the bisection process has finnished, issue the following command:\n+\n+------------\n+$ git bisect state\n+------------\n+\n+Exit successfully (i.e., with return code 0), if and only if the current\n+bisection has reached the first bad or possible first bad commit.\n+\n Bisect visualize\n ~~~~~~~~~~~~~~~~\n \ndiff --git a/git-bisect.sh b/git-bisect.sh\nindex 9f064b6..6ddda34 100755\n--- a/git-bisect.sh\n+++ b/git-bisect.sh\n@@ -1,6 +1,6 @@\n #!/bin/sh\n \n-USAGE='[help|start|bad|good|skip|next|reset|visualize|replay|log|run]'\n+USAGE='[help|start|bad|good|skip|next|reset|visualize|replay|log|run|state]'\n LONG_USAGE='git bisect help\n \tprint this long help message.\n git bisect start [--no-checkout] [<bad> [<good>...]] [--] [<pathspec>...]\n@@ -23,6 +23,8 @@ git bisect log\n \tshow bisect log.\n git bisect run <cmd>...\n \tuse <cmd>... to automatically bisect.\n+git bisect state\n+\tcheck if the bisection is complete.\n \n Please use \"git help bisect\" to get the full man page.'\n \n@@ -491,6 +493,11 @@ bisect_log () {\n \tcat \"$GIT_DIR/BISECT_LOG\"\n }\n \n+bisect_complete_state () {\n+\tcat \"$GIT_DIR/BISECT_LOG\" | tail -n 1 | grep -E '^# (possible |)first bad commit:' > /dev/null\n+\texit $?\n+}\n+\n case \"$#\" in\n 0)\n \tusage ;;\n@@ -519,6 +526,8 @@ case \"$#\" in\n \t\tbisect_log ;;\n \trun)\n \t\tbisect_run \"$@\" ;;\n+\tstate)\n+\t\tbisect_complete_state ;;\n \t*)\n \t\tusage ;;\n \tesac\n-- \n1.8.3.4\n"},{"id":"225312","messageId":"CAPig+cTfdnMRT61NQoHcF9-tt-wHABKPHi8HBXijQeB-jb1VyQ@mail.gmail.com","threadId":"34708","inReplyTo":"1376606112-1712-1-git-send-email-maandree@operamail.com","subject":"Re: [PATCH] Add command `git bisect state` that checks if the current bisection process has reached the first bad commit.","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2013-08-16T04:17:27Z","receivedAt":"2013-08-16T04:17:27Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Thu, Aug 15, 2013 at 6:35 PM, Mattias Andrée <maandree@operamail.com> wrote:\n> This can be used for automated bisection without a check script.\n>\n> Signed-off-by: Mattias Andrée <maandree@operamail.com>\n> ---\n>  Documentation/git-bisect.txt | 13 +++++++++++++\n>  git-bisect.sh                | 11 ++++++++++-\n>  2 files changed, 23 insertions(+), 1 deletion(-)\n>\n> diff --git a/Documentation/git-bisect.txt b/Documentation/git-bisect.txt\n> index f986c5c..ca8c09d 100644\n> --- a/Documentation/git-bisect.txt\n> +++ b/Documentation/git-bisect.txt\n> @@ -25,6 +25,7 @@ on the subcommand:\n>   git bisect visualize\n>   git bisect replay <logfile>\n>   git bisect log\n> + git bisect state\n>   git bisect run <cmd>...\n>\n>  This command uses 'git rev-list --bisect' to help drive the\n> @@ -104,6 +105,18 @@ For example, `git bisect reset HEAD` will leave you on the current\n>  bisection commit and avoid switching commits at all, while `git bisect\n>  reset bisect/bad` will check out the first bad revision.\n>\n> +Bisect state\n> +~~~~~~~~~~~~~~~~\n> +\n> +To see the bisection process has finnished, issue the following command:\n\ns/see the/see if the/\ns/finnished/finished/\n\n> +\n> +------------\n> +$ git bisect state\n> +------------\n> +\n> +Exit successfully (i.e., with return code 0), if and only if the current\n> +bisection has reached the first bad or possible first bad commit.\n> +\n>  Bisect visualize\n>  ~~~~~~~~~~~~~~~~\n>\n> diff --git a/git-bisect.sh b/git-bisect.sh\n> index 9f064b6..6ddda34 100755\n> --- a/git-bisect.sh\n> +++ b/git-bisect.sh\n> @@ -1,6 +1,6 @@\n>  #!/bin/sh\n>\n> -USAGE='[help|start|bad|good|skip|next|reset|visualize|replay|log|run]'\n> +USAGE='[help|start|bad|good|skip|next|reset|visualize|replay|log|run|state]'\n>  LONG_USAGE='git bisect help\n>         print this long help message.\n>  git bisect start [--no-checkout] [<bad> [<good>...]] [--] [<pathspec>...]\n> @@ -23,6 +23,8 @@ git bisect log\n>         show bisect log.\n>  git bisect run <cmd>...\n>         use <cmd>... to automatically bisect.\n> +git bisect state\n> +       check if the bisection is complete.\n>\n>  Please use \"git help bisect\" to get the full man page.'\n>\n> @@ -491,6 +493,11 @@ bisect_log () {\n>         cat \"$GIT_DIR/BISECT_LOG\"\n>  }\n>\n> +bisect_complete_state () {\n> +       cat \"$GIT_DIR/BISECT_LOG\" | tail -n 1 | grep -E '^# (possible |)first bad commit:' > /dev/null\n> +       exit $?\n> +}\n> +\n>  case \"$#\" in\n>  0)\n>         usage ;;\n> @@ -519,6 +526,8 @@ case \"$#\" in\n>                 bisect_log ;;\n>         run)\n>                 bisect_run \"$@\" ;;\n> +       state)\n> +               bisect_complete_state ;;\n>         *)\n>                 usage ;;\n>         esac\n> --\n> 1.8.3.4\n>\n> --\n> To unsubscribe from this list: send the line \"unsubscribe git\" in\n> the body of a message to majordomo@vger.kernel.org\n> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n"},{"id":"225313","messageId":"20130816065410.56665c03.maandree@kth.se","threadId":"34708","inReplyTo":"CAPig+cTfdnMRT61NQoHcF9-tt-wHABKPHi8HBXijQeB-jb1VyQ@mail.gmail.com","subject":"Re: [PATCH] Add command `git bisect state` that checks if the current bisection process has reached the first bad commit.","fromName":"Mattias Andrée","fromEmail":"maandree@member.fsf.org","sentAt":"2013-08-16T04:54:10Z","receivedAt":"2013-08-16T04:54:10Z","isPatch":true,"sender":{"key":"maandree@member.fsf.org","avatar":"https://gravatar.com/avatar/c0e80286758dabb418fed17937e45c5c5ba5b5c96ec89f55225866c588244254?d=mp&s=160"},"body":"On Fri, 16 Aug 2013 00:17:27 -0400\nEric Sunshine <sunshine@sunshineco.com> wrote:\n\n> On Thu, Aug 15, 2013 at 6:35 PM, Mattias Andrée\n> <maandree@operamail.com> wrote:\n> > This can be used for automated bisection without a\n> > check script.\n> >\n> > Signed-off-by: Mattias Andrée <maandree@operamail.com>\n> > ---\n> >  Documentation/git-bisect.txt | 13 +++++++++++++\n> >  git-bisect.sh                | 11 ++++++++++-\n> >  2 files changed, 23 insertions(+), 1 deletion(-)\n> >\n> > diff --git a/Documentation/git-bisect.txt\n> > b/Documentation/git-bisect.txt index f986c5c..ca8c09d\n> > 100644 --- a/Documentation/git-bisect.txt\n> > +++ b/Documentation/git-bisect.txt\n> > @@ -25,6 +25,7 @@ on the subcommand:\n> >   git bisect visualize\n> >   git bisect replay <logfile>\n> >   git bisect log\n> > + git bisect state\n> >   git bisect run <cmd>...\n> >\n> >  This command uses 'git rev-list --bisect' to help\n> > drive the @@ -104,6 +105,18 @@ For example, `git bisect\n> > reset HEAD` will leave you on the current bisection\n> > commit and avoid switching commits at all, while `git\n> > bisect reset bisect/bad` will check out the first bad\n> > revision.\n> >\n> > +Bisect state\n> > +~~~~~~~~~~~~~~~~\n> > +\n> > +To see the bisection process has finnished, issue the\n> > following command:\n> \n> s/see the/see if the/\n> s/finnished/finished/\n\nOh, I should have proofread the text. However,\nthe command name ‘state’ may not be the best,\nbut I could not think of anything better, so\nI am open for comments on a better name.\n\n\n\nThe purpose of this patch is to provide an\nissue what to do an automated `git bisect`\nwithout having to write an script file.\n\nThis patch allows you to an automated by section\nby just like if it was a manual, i.e. stating\nwith `git bisect start && git bisect bad &&\ngit bisect good <commit>` but then type:\n\nwhile ! git bisect state; do\n<test command> && git bisect good || git bisect bad\ndone\n\nI think this is useful to lower the barrier\nof entry for `git bisect`, as well as making\nit easy to create regression testing scripts\nthat do not have to be run with `git bisect run`.\n\nFor example if you have a lot of regression tests,\nyou can have a script for each that tests if\nif their is a bug and if so bisect it, and print\ninformation about what is testing, all from with\nscript for each regression test. This way, you\ncan have a directory of regression tests that\nare invoked just as normal script files and have\na master script that runs all of them.\nSo other developers on the project does not even\nneed to know how to use `git bisect`.\n\n\n\n> \n> > +\n> > +------------\n> > +$ git bisect state\n> > +------------\n> > +\n> > +Exit successfully (i.e., with return code 0), if and\n> > only if the current +bisection has reached the first\n> > bad or possible first bad commit. +\n> >  Bisect visualize\n> >  ~~~~~~~~~~~~~~~~\n> >\n> > diff --git a/git-bisect.sh b/git-bisect.sh\n> > index 9f064b6..6ddda34 100755\n> > --- a/git-bisect.sh\n> > +++ b/git-bisect.sh\n> > @@ -1,6 +1,6 @@\n> >  #!/bin/sh\n> >\n> > -USAGE='[help|start|bad|good|skip|next|reset|visualize|replay|log|run]'\n> > +USAGE='[help|start|bad|good|skip|next|reset|visualize|replay|log|run|state]'\n> >  LONG_USAGE='git bisect help\n> >         print this long help message.\n> >  git bisect start [--no-checkout] [<bad> [<good>...]]\n> > [--] [<pathspec>...] @@ -23,6 +23,8 @@ git bisect log\n> >         show bisect log.\n> >  git bisect run <cmd>...\n> >         use <cmd>... to automatically bisect.\n> > +git bisect state\n> > +       check if the bisection is complete.\n> >\n> >  Please use \"git help bisect\" to get the full man page.'\n> >\n> > @@ -491,6 +493,11 @@ bisect_log () {\n> >         cat \"$GIT_DIR/BISECT_LOG\"\n> >  }\n> >\n> > +bisect_complete_state () {\n> > +       cat \"$GIT_DIR/BISECT_LOG\" | tail -n 1 | grep -E\n> > '^# (possible |)first bad commit:' > /dev/null\n> > +       exit $?\n> > +}\n> > +\n> >  case \"$#\" in\n> >  0)\n> >         usage ;;\n> > @@ -519,6 +526,8 @@ case \"$#\" in\n> >                 bisect_log ;;\n> >         run)\n> >                 bisect_run \"$@\" ;;\n> > +       state)\n> > +               bisect_complete_state ;;\n> >         *)\n> >                 usage ;;\n> >         esac\n> > --\n> > 1.8.3.4\n> >\n> > --\n> > To unsubscribe from this list: send the line\n> > \"unsubscribe git\" in the body of a message to\n> > majordomo@vger.kernel.org More majordomo info at\n> > http://vger.kernel.org/majordomo-info.html\n"},{"id":"225434","messageId":"7vmwoen0g8.fsf@alter.siamese.dyndns.org","threadId":"34708","inReplyTo":"20130816065410.56665c03.maandree@kth.se","subject":"Re: [PATCH] Add command `git bisect state` that checks if the current bisection process has reached the first bad commit.","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-08-18T21:39:03Z","receivedAt":"2013-08-18T21:39:03Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Mattias Andrée <maandree@member.fsf.org> writes:\n\n> This patch allows you to an automated by section\n> by just like if it was a manual, i.e. stating\n> with `git bisect start && git bisect bad &&\n> git bisect good <commit>` but then type:\n>\n> while ! git bisect state; do\n> <test command> && git bisect good || git bisect bad\n> done\n\nHmph, so this is \"git bisect run\" turned inside out?\n"}]}