# [PATCH 2/2] Documentation: bisect: add a few "git bisect run" examples

6 messages from 2008-05-07 to 2008-05-07. Participants: Christian Couder, Junio C Hamano, Matthieu Moy, Miklos Vajna, Jon Loeliger.
Thread: https://gitlist.dev/t/13406

## Christian Couder, 2008-05-07 04:29

Subject: [PATCH 2/2] Documentation: bisect: add a few "git bisect run" examples
Message-ID: <20080507062931.dd72d7e1.chriscool@tuxfamily.org>
URL: https://gitlist.dev/e/20080507062931.dd72d7e1.chriscool%40tuxfamily.org

```
Before this patch, there were no proper "git bisect run" example.
---
 Documentation/git-bisect.txt |   26 ++++++++++++++++++++++++++
 1 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/Documentation/git-bisect.txt b/Documentation/git-bisect.txt
index 698ffde..a05963a 100644
--- a/Documentation/git-bisect.txt
+++ b/Documentation/git-bisect.txt
@@ -224,6 +224,32 @@ tree to the pristine state.  Finally the "run" script can exit with
 the status of the real test to let "git bisect run" command loop to
 know the outcome.
 
+EXAMPLES
+--------
+
+* Automatically bisect a broken build between v1.2 and HEAD:
++
+------------
+$ git bisect start HEAD v1.2 --      # HEAD is bad, v1.2 is good
+$ git bisect run make                # "make" builds the app
+------------
+
+* Automatically bisect a broken test case using a custom script:
++
+------------
+echo "#"\!"/bin/sh" > ~/test.sh
+echo "make install || exit 125" >> ~/test.sh
+echo "~/check_test_case.sh" >> ~/test.sh
+chmod u+x ~/test.sh
+$ git bisect start v1.3 v1.1 --      # v1.3 is bad, v1.1 is good
+$ git bisect run ~/test.sh
+------------
++
+Here we first create the "test.sh" custom script. In this script, if
+"make install" fails, we "skip" the current commit.
+And "check_test_case.sh" should "exit 0", if the test case passes, and
+"exit 1" (for example) otherwise.
+
 Author
 ------
 Written by Linus Torvalds <torvalds@osdl.org>
-- 
1.5.5.1.126.g9ca01

```

## Junio C Hamano, 2008-05-07 04:59

Subject: Re: [PATCH 2/2] Documentation: bisect: add a few "git bisect run" examples
Message-ID: <7vwsm6g14i.fsf@gitster.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vwsm6g14i.fsf%40gitster.siamese.dyndns.org
In-Reply-To: <20080507062931.dd72d7e1.chriscool@tuxfamily.org>

```
Christian Couder <chriscool@tuxfamily.org> writes:

> Before this patch, there were no proper "git bisect run" example.

As if there were improper examples, and as if this patch adds a proper
one.  Drop "proper" and add sign-off perhaps?  ;-)

> ---
>  Documentation/git-bisect.txt |   26 ++++++++++++++++++++++++++
>  1 files changed, 26 insertions(+), 0 deletions(-)
>
> diff --git a/Documentation/git-bisect.txt b/Documentation/git-bisect.txt
> index 698ffde..a05963a 100644
> --- a/Documentation/git-bisect.txt
> +++ b/Documentation/git-bisect.txt
> @@ -224,6 +224,32 @@ tree to the pristine state.  Finally the "run" script can exit with
>  the status of the real test to let "git bisect run" command loop to
>  know the outcome.
>  
> +EXAMPLES
> +--------
> ...
> +* Automatically bisect a broken test case using a custom script:
> ++
> +------------
> +echo "#"\!"/bin/sh" > ~/test.sh
> +echo "make install || exit 125" >> ~/test.sh
> +echo "~/check_test_case.sh" >> ~/test.sh
> +chmod u+x ~/test.sh

s/install//; let's not set a bad example of installing first and then
testing.

```

## Matthieu Moy, 2008-05-07 06:29

Subject: Re: [PATCH 2/2] Documentation: bisect: add a few "git bisect run" examples
Message-ID: <vpqlk2mbpao.fsf@bauges.imag.fr>
URL: https://gitlist.dev/e/vpqlk2mbpao.fsf%40bauges.imag.fr
In-Reply-To: <7vwsm6g14i.fsf@gitster.siamese.dyndns.org>

```
Junio C Hamano <gitster@pobox.com> writes:

>> +------------
>> +echo "#"\!"/bin/sh" > ~/test.sh
>> +echo "make install || exit 125" >> ~/test.sh
>> +echo "~/check_test_case.sh" >> ~/test.sh
>> +chmod u+x ~/test.sh
>
> s/install//; let's not set a bad example of installing first and then
> testing.

Perhaps also s/~/./g, since it's not a good idea to put temporary
files in $HOME IMHO.

Also, using simple quotes instead of double would simplify the
"#"\!"/bin/sh".

-- 
Matthieu

```

## Miklos Vajna, 2008-05-07 07:25

Subject: Re: [PATCH 2/2] Documentation: bisect: add a few "git bisect run" examples
Message-ID: <20080507072536.GJ23672@genesis.frugalware.org>
URL: https://gitlist.dev/e/20080507072536.GJ23672%40genesis.frugalware.org
In-Reply-To: <vpqlk2mbpao.fsf@bauges.imag.fr>

```
On Wed, May 07, 2008 at 08:29:03AM +0200, Matthieu Moy <Matthieu.Moy@imag.fr> wrote:
> Perhaps also s/~/./g, since it's not a good idea to put temporary
> files in $HOME IMHO.

the point is to have it outside the repo. at least i regularly have 'git
clean -f -x -d' in such a script if i don't trust the upstream build
system. ;)

```

## Jon Loeliger, 2008-05-07 16:09

Subject: Re: [PATCH 2/2] Documentation: bisect: add a few "git bisect run" examples
Message-ID: <1210176560.6102.9.camel@ld0161-tx32>
URL: https://gitlist.dev/e/1210176560.6102.9.camel%40ld0161-tx32
In-Reply-To: <vpqlk2mbpao.fsf@bauges.imag.fr>

```
On Wed, 2008-05-07 at 08:29 +0200, Matthieu Moy wrote:
> Junio C Hamano <gitster@pobox.com> writes:
> 
> >> +------------
> >> +echo "#"\!"/bin/sh" > ~/test.sh
> >> +echo "make install || exit 125" >> ~/test.sh
> >> +echo "~/check_test_case.sh" >> ~/test.sh
> >> +chmod u+x ~/test.sh
> >
> > s/install//; let's not set a bad example of installing first and then
> > testing.
> 
> Perhaps also s/~/./g, since it's not a good idea to put temporary
> files in $HOME IMHO.
> 
> Also, using simple quotes instead of double would simplify the
> "#"\!"/bin/sh".

Hmm.  I would have just done "$ cat ~/test.sh" and
then shown the file listing directly.

jdl

```

## Christian Couder, 2008-05-07 22:18

Subject: Re: [PATCH 2/2] Documentation: bisect: add a few "git bisect run" examples
Message-ID: <200805080018.40181.chriscool@tuxfamily.org>
URL: https://gitlist.dev/e/200805080018.40181.chriscool%40tuxfamily.org
In-Reply-To: <20080507072536.GJ23672@genesis.frugalware.org>

```
Le mercredi 7 mai 2008, Miklos Vajna a écrit :
> On Wed, May 07, 2008 at 08:29:03AM +0200, Matthieu Moy 
<Matthieu.Moy@imag.fr> wrote:
> > Perhaps also s/~/./g, since it's not a good idea to put temporary
> > files in $HOME IMHO.
>
> the point is to have it outside the repo. 

Yes. Especially, if the test case is a new one, the scripts that are used 
must not have been checked in. Otherwise when bisect will checkout older 
versions, the scripts will be removed.

> at least i regularly have 'git 
> clean -f -x -d' in such a script if i don't trust the upstream build
> system. ;)

```
