threads / patch / 13406

patch, 2 partsDocumentation: bisect: add a few "git bisect run" examples

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

## tl;dr

6 messages between May 7, 2008 and May 7, 2008. Diffs are folded; open one to read it.

replies: 5people: 5as markdown or json

Christian Couder· May 7, 2008, 04:29 UTC · lore
Before this patch, there were no proper "git bisect run" example.
---
 Documentation/git-bisect.txt |   26 ++++++++++++++++++++++++++
 1 files changed, 26 insertions(+), 0 deletions(-)
Show changes to Documentation/git-bisect.txt +26 −0
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· May 7, 2008, 04:59 UTC · re: Christian Couder · lore

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

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? ;-)

Show 22 quoted lines
> ---
>  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· May 7, 2008, 06:29 UTC · re: Junio C Hamano · lore

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

Junio C Hamano <gitster@pobox.com> writes:
Show 8 quoted lines
>> +------------
>> +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· May 7, 2008, 07:25 UTC · re: Matthieu Moy · lore

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

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. ;)

Christian Couder· May 7, 2008, 22:18 UTC · re: Miklos Vajna · lore

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

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. ;)
Jon Loeliger· May 7, 2008, 16:09 UTC · re: Matthieu Moy · lore

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

On Wed, 2008-05-07 at 08:29 +0200, Matthieu Moy wrote:
Show 16 quoted lines
> 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

← back to recent threads