git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Add command `git bisect state` that checks if the current bisection process has reached the first bad commit.
@ 2013-08-15 22:35 Mattias Andrée
  2013-08-16  4:17 ` Eric Sunshine
  0 siblings, 1 reply; 4+ messages in thread
From: Mattias Andrée @ 2013-08-15 22:35 UTC (permalink / raw)
  To: git; +Cc: Mattias Andrée

This can be used for automated bisection without a check script.

Signed-off-by: Mattias Andrée <maandree@operamail.com>
---
 Documentation/git-bisect.txt | 13 +++++++++++++
 git-bisect.sh                | 11 ++++++++++-
 2 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/Documentation/git-bisect.txt b/Documentation/git-bisect.txt
index f986c5c..ca8c09d 100644
--- a/Documentation/git-bisect.txt
+++ b/Documentation/git-bisect.txt
@@ -25,6 +25,7 @@ on the subcommand:
  git bisect visualize
  git bisect replay <logfile>
  git bisect log
+ git bisect state
  git bisect run <cmd>...
 
 This command uses 'git rev-list --bisect' to help drive the
@@ -104,6 +105,18 @@ For example, `git bisect reset HEAD` will leave you on the current
 bisection commit and avoid switching commits at all, while `git bisect
 reset bisect/bad` will check out the first bad revision.
 
+Bisect state
+~~~~~~~~~~~~~~~~
+
+To see the bisection process has finnished, issue the following command:
+
+------------
+$ git bisect state
+------------
+
+Exit successfully (i.e., with return code 0), if and only if the current
+bisection has reached the first bad or possible first bad commit.
+
 Bisect visualize
 ~~~~~~~~~~~~~~~~
 
diff --git a/git-bisect.sh b/git-bisect.sh
index 9f064b6..6ddda34 100755
--- a/git-bisect.sh
+++ b/git-bisect.sh
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-USAGE='[help|start|bad|good|skip|next|reset|visualize|replay|log|run]'
+USAGE='[help|start|bad|good|skip|next|reset|visualize|replay|log|run|state]'
 LONG_USAGE='git bisect help
 	print this long help message.
 git bisect start [--no-checkout] [<bad> [<good>...]] [--] [<pathspec>...]
@@ -23,6 +23,8 @@ git bisect log
 	show bisect log.
 git bisect run <cmd>...
 	use <cmd>... to automatically bisect.
+git bisect state
+	check if the bisection is complete.
 
 Please use "git help bisect" to get the full man page.'
 
@@ -491,6 +493,11 @@ bisect_log () {
 	cat "$GIT_DIR/BISECT_LOG"
 }
 
+bisect_complete_state () {
+	cat "$GIT_DIR/BISECT_LOG" | tail -n 1 | grep -E '^# (possible |)first bad commit:' > /dev/null
+	exit $?
+}
+
 case "$#" in
 0)
 	usage ;;
@@ -519,6 +526,8 @@ case "$#" in
 		bisect_log ;;
 	run)
 		bisect_run "$@" ;;
+	state)
+		bisect_complete_state ;;
 	*)
 		usage ;;
 	esac
-- 
1.8.3.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] Add command `git bisect state` that checks if the current bisection process has reached the first bad commit.
  2013-08-15 22:35 [PATCH] Add command `git bisect state` that checks if the current bisection process has reached the first bad commit Mattias Andrée
@ 2013-08-16  4:17 ` Eric Sunshine
  2013-08-16  4:54   ` Mattias Andrée
  0 siblings, 1 reply; 4+ messages in thread
From: Eric Sunshine @ 2013-08-16  4:17 UTC (permalink / raw)
  To: Mattias Andrée; +Cc: Git List

On Thu, Aug 15, 2013 at 6:35 PM, Mattias Andrée <maandree@operamail.com> wrote:
> This can be used for automated bisection without a check script.
>
> Signed-off-by: Mattias Andrée <maandree@operamail.com>
> ---
>  Documentation/git-bisect.txt | 13 +++++++++++++
>  git-bisect.sh                | 11 ++++++++++-
>  2 files changed, 23 insertions(+), 1 deletion(-)
>
> diff --git a/Documentation/git-bisect.txt b/Documentation/git-bisect.txt
> index f986c5c..ca8c09d 100644
> --- a/Documentation/git-bisect.txt
> +++ b/Documentation/git-bisect.txt
> @@ -25,6 +25,7 @@ on the subcommand:
>   git bisect visualize
>   git bisect replay <logfile>
>   git bisect log
> + git bisect state
>   git bisect run <cmd>...
>
>  This command uses 'git rev-list --bisect' to help drive the
> @@ -104,6 +105,18 @@ For example, `git bisect reset HEAD` will leave you on the current
>  bisection commit and avoid switching commits at all, while `git bisect
>  reset bisect/bad` will check out the first bad revision.
>
> +Bisect state
> +~~~~~~~~~~~~~~~~
> +
> +To see the bisection process has finnished, issue the following command:

s/see the/see if the/
s/finnished/finished/

> +
> +------------
> +$ git bisect state
> +------------
> +
> +Exit successfully (i.e., with return code 0), if and only if the current
> +bisection has reached the first bad or possible first bad commit.
> +
>  Bisect visualize
>  ~~~~~~~~~~~~~~~~
>
> diff --git a/git-bisect.sh b/git-bisect.sh
> index 9f064b6..6ddda34 100755
> --- a/git-bisect.sh
> +++ b/git-bisect.sh
> @@ -1,6 +1,6 @@
>  #!/bin/sh
>
> -USAGE='[help|start|bad|good|skip|next|reset|visualize|replay|log|run]'
> +USAGE='[help|start|bad|good|skip|next|reset|visualize|replay|log|run|state]'
>  LONG_USAGE='git bisect help
>         print this long help message.
>  git bisect start [--no-checkout] [<bad> [<good>...]] [--] [<pathspec>...]
> @@ -23,6 +23,8 @@ git bisect log
>         show bisect log.
>  git bisect run <cmd>...
>         use <cmd>... to automatically bisect.
> +git bisect state
> +       check if the bisection is complete.
>
>  Please use "git help bisect" to get the full man page.'
>
> @@ -491,6 +493,11 @@ bisect_log () {
>         cat "$GIT_DIR/BISECT_LOG"
>  }
>
> +bisect_complete_state () {
> +       cat "$GIT_DIR/BISECT_LOG" | tail -n 1 | grep -E '^# (possible |)first bad commit:' > /dev/null
> +       exit $?
> +}
> +
>  case "$#" in
>  0)
>         usage ;;
> @@ -519,6 +526,8 @@ case "$#" in
>                 bisect_log ;;
>         run)
>                 bisect_run "$@" ;;
> +       state)
> +               bisect_complete_state ;;
>         *)
>                 usage ;;
>         esac
> --
> 1.8.3.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Add command `git bisect state` that checks if the current bisection process has reached the first bad commit.
  2013-08-16  4:17 ` Eric Sunshine
@ 2013-08-16  4:54   ` Mattias Andrée
  2013-08-18 21:39     ` Junio C Hamano
  0 siblings, 1 reply; 4+ messages in thread
From: Mattias Andrée @ 2013-08-16  4:54 UTC (permalink / raw)
  To: Eric Sunshine, maandree; +Cc: Git List

On Fri, 16 Aug 2013 00:17:27 -0400
Eric Sunshine <sunshine@sunshineco.com> wrote:

> On Thu, Aug 15, 2013 at 6:35 PM, Mattias Andrée
> <maandree@operamail.com> wrote:
> > This can be used for automated bisection without a
> > check script.
> >
> > Signed-off-by: Mattias Andrée <maandree@operamail.com>
> > ---
> >  Documentation/git-bisect.txt | 13 +++++++++++++
> >  git-bisect.sh                | 11 ++++++++++-
> >  2 files changed, 23 insertions(+), 1 deletion(-)
> >
> > diff --git a/Documentation/git-bisect.txt
> > b/Documentation/git-bisect.txt index f986c5c..ca8c09d
> > 100644 --- a/Documentation/git-bisect.txt
> > +++ b/Documentation/git-bisect.txt
> > @@ -25,6 +25,7 @@ on the subcommand:
> >   git bisect visualize
> >   git bisect replay <logfile>
> >   git bisect log
> > + git bisect state
> >   git bisect run <cmd>...
> >
> >  This command uses 'git rev-list --bisect' to help
> > drive the @@ -104,6 +105,18 @@ For example, `git bisect
> > reset HEAD` will leave you on the current bisection
> > commit and avoid switching commits at all, while `git
> > bisect reset bisect/bad` will check out the first bad
> > revision.
> >
> > +Bisect state
> > +~~~~~~~~~~~~~~~~
> > +
> > +To see the bisection process has finnished, issue the
> > following command:
> 
> s/see the/see if the/
> s/finnished/finished/

Oh, I should have proofread the text. However,
the command name ‘state’ may not be the best,
but I could not think of anything better, so
I am open for comments on a better name.



The purpose of this patch is to provide an
issue what to do an automated `git bisect`
without having to write an script file.

This patch allows you to an automated by section
by just like if it was a manual, i.e. stating
with `git bisect start && git bisect bad &&
git bisect good <commit>` but then type:

while ! git bisect state; do
<test command> && git bisect good || git bisect bad
done

I think this is useful to lower the barrier
of entry for `git bisect`, as well as making
it easy to create regression testing scripts
that do not have to be run with `git bisect run`.

For example if you have a lot of regression tests,
you can have a script for each that tests if
if their is a bug and if so bisect it, and print
information about what is testing, all from with
script for each regression test. This way, you
can have a directory of regression tests that
are invoked just as normal script files and have
a master script that runs all of them.
So other developers on the project does not even
need to know how to use `git bisect`.



> 
> > +
> > +------------
> > +$ git bisect state
> > +------------
> > +
> > +Exit successfully (i.e., with return code 0), if and
> > only if the current +bisection has reached the first
> > bad or possible first bad commit. +
> >  Bisect visualize
> >  ~~~~~~~~~~~~~~~~
> >
> > diff --git a/git-bisect.sh b/git-bisect.sh
> > index 9f064b6..6ddda34 100755
> > --- a/git-bisect.sh
> > +++ b/git-bisect.sh
> > @@ -1,6 +1,6 @@
> >  #!/bin/sh
> >
> > -USAGE='[help|start|bad|good|skip|next|reset|visualize|replay|log|run]'
> > +USAGE='[help|start|bad|good|skip|next|reset|visualize|replay|log|run|state]'
> >  LONG_USAGE='git bisect help
> >         print this long help message.
> >  git bisect start [--no-checkout] [<bad> [<good>...]]
> > [--] [<pathspec>...] @@ -23,6 +23,8 @@ git bisect log
> >         show bisect log.
> >  git bisect run <cmd>...
> >         use <cmd>... to automatically bisect.
> > +git bisect state
> > +       check if the bisection is complete.
> >
> >  Please use "git help bisect" to get the full man page.'
> >
> > @@ -491,6 +493,11 @@ bisect_log () {
> >         cat "$GIT_DIR/BISECT_LOG"
> >  }
> >
> > +bisect_complete_state () {
> > +       cat "$GIT_DIR/BISECT_LOG" | tail -n 1 | grep -E
> > '^# (possible |)first bad commit:' > /dev/null
> > +       exit $?
> > +}
> > +
> >  case "$#" in
> >  0)
> >         usage ;;
> > @@ -519,6 +526,8 @@ case "$#" in
> >                 bisect_log ;;
> >         run)
> >                 bisect_run "$@" ;;
> > +       state)
> > +               bisect_complete_state ;;
> >         *)
> >                 usage ;;
> >         esac
> > --
> > 1.8.3.4
> >
> > --
> > To unsubscribe from this list: send the line
> > "unsubscribe git" in the body of a message to
> > majordomo@vger.kernel.org More majordomo info at
> > http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Add command `git bisect state` that checks if the current bisection process has reached the first bad commit.
  2013-08-16  4:54   ` Mattias Andrée
@ 2013-08-18 21:39     ` Junio C Hamano
  0 siblings, 0 replies; 4+ messages in thread
From: Junio C Hamano @ 2013-08-18 21:39 UTC (permalink / raw)
  To: Mattias Andrée; +Cc: Eric Sunshine, Git List

Mattias Andrée <maandree@member.fsf.org> writes:

> This patch allows you to an automated by section
> by just like if it was a manual, i.e. stating
> with `git bisect start && git bisect bad &&
> git bisect good <commit>` but then type:
>
> while ! git bisect state; do
> <test command> && git bisect good || git bisect bad
> done

Hmph, so this is "git bisect run" turned inside out?

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-08-18 21:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-15 22:35 [PATCH] Add command `git bisect state` that checks if the current bisection process has reached the first bad commit Mattias Andrée
2013-08-16  4:17 ` Eric Sunshine
2013-08-16  4:54   ` Mattias Andrée
2013-08-18 21:39     ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).