All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] bisect: revise manpage
@ 2015-06-26 11:30 Michael Haggerty
  2015-06-26 12:44 ` Christian Couder
  2015-06-26 12:50 ` [PATCH] bisect: revise manpage Matthieu Moy
  0 siblings, 2 replies; 13+ messages in thread
From: Michael Haggerty @ 2015-06-26 11:30 UTC (permalink / raw)
  To: Junio C Hamano
  Cc: antoine.delaite, louis--alexandre.stuber, chriscool, thomasxnguy,
	valentinduperray, Matthieu Moy, git, Michael Haggerty

Thoroughly revise the "git bisect" manpage, including:

* Beef up the "Description" section.

* Integrate the good/bad alternate terms into more of the text.

* Merge the sections "Alternative terms: bisect new and bisect old"
  and "Alternative terms: use your own terms" into a single "Alternate
  terms" section.

* Make the first long example less specific to kernel development.

* De-emphasize implementation details in a couple of places.

* Add "(roughly N steps)" in the places where example output is shown.

* Move the "Getting help" section down.

* Remove the "Look for a fix instead of a regression in the code"
  example, as (1) it was in the "git bisect run" section, but it
  doesn't use that command, and (2) I think this usage is adequately
  explained in the "Alternate terms" section.

* Properly markup code within the prose.

* Lots of wordsmithing.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
---
As I was reading the changes to the "git bisect" docs while trying to
understand Antoine Delaite's "bisect-terms" branch, I got the feeling
that the manpage could use some love. This is the result.

This patch applies on top of Antoine Delaite's "bisect-terms" branch
(as downloaded from Matthiew Moy's GitHub repo). It contains many
changes to the git-bisect manpage that I think improve the page
overall and also better integrate the documentation for the new
"terms" feature. Feel free to pick and choose parts of the changes.

 Documentation/git-bisect.txt | 230 +++++++++++++++++++++++--------------------
 1 file changed, 125 insertions(+), 105 deletions(-)

diff --git a/Documentation/git-bisect.txt b/Documentation/git-bisect.txt
index ce7be5a..2de8b3a 100644
--- a/Documentation/git-bisect.txt
+++ b/Documentation/git-bisect.txt
@@ -3,7 +3,7 @@ git-bisect(1)
 
 NAME
 ----
-git-bisect - Find by binary search the change that introduced a bug
+git-bisect - Use binary search to find the commit that introduced a bug
 
 
 SYNOPSIS
@@ -16,7 +16,6 @@ DESCRIPTION
 The command takes various subcommands, and different options depending
 on the subcommand:
 
- git bisect help
  git bisect start [--no-checkout] [<bad> [<good>...]] [--] [<paths>...]
  git bisect (bad|new) [<rev>]
  git bisect (good|old) [<rev>...]
@@ -26,64 +25,80 @@ on the subcommand:
  git bisect replay <logfile>
  git bisect log
  git bisect run <cmd>...
+ git bisect help
 
-This command uses 'git rev-list --bisect' to help drive the
-binary search process to find which change introduced a bug, given an
-old "good" commit object name and a later "bad" commit object name.
+This command uses a binary search algorithm to find which commit in
+your project's history introduced a bug. You use it by first telling
+it a "bad" commit that is known to contain the bug, and a "good"
+commit that is known to be before the bug was introduced. Then `git
+bisect` picks a commit between those two endpoints and asks you
+whether the selected commit is "good" or "bad". It continues narrowing
+down the range until it finds the exact commit that introduced the
+change.
 
-Getting help
-~~~~~~~~~~~~
+In fact, `git bisect` can be used to find the commit that changed
+*any* property of your project; e.g., the commit that fixed a bug, or
+the commit that caused a benchmark's performance to improve. To
+support this more general usage, the terms "old" and "new" can be used
+in place of "good" and "bad", or you can choose your own terms. See
+section "Alternate terms" below for more information.
 
-Use "git bisect" to get a short usage description, and "git bisect
-help" or "git bisect -h" to get a long usage description.
 
 Basic bisect commands: start, bad, good
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-Using the Linux kernel tree as an example, basic use of the bisect
-command is as follows:
+As an example, suppose you are trying to find the commit that broke a
+feature that was known to work in version `v2.6.13-rc2` of your
+project. You start a bisect session as follows:
 
 ------------------------------------------------
 $ git bisect start
 $ git bisect bad                 # Current version is bad
-$ git bisect good v2.6.13-rc2    # v2.6.13-rc2 was the last version
-                                 # tested that was good
+$ git bisect good v2.6.13-rc2    # v2.6.13-rc2 is known to be good
+------------------------------------------------
+
+Once you have specified at least one bad and one good commit, `git
+bisect` selects a commit in the middle of that range of history,
+checks it out, and outputs something similar to the following:
+
+------------------------------------------------
+Bisecting: 675 revisions left to test after this (roughly 10 steps)
 ------------------------------------------------
 
-When you have specified at least one bad and one good version, the
-command bisects the revision tree and outputs something similar to
-the following:
+You should now compile the checked-out version and test it. If that
+version works correctly, type
 
 ------------------------------------------------
-Bisecting: 675 revisions left to test after this
+$ git bisect good
 ------------------------------------------------
 
-The state in the middle of the set of revisions is then checked out.
-You would now compile that kernel and boot it. If the booted kernel
-works correctly, you would then issue the following command:
+If that version is broken, type
 
 ------------------------------------------------
-$ git bisect good			# this one is good
+$ git bisect bad
 ------------------------------------------------
 
-The output of this command would be something similar to the following:
+Then `git bisect` will respond with something like
 
 ------------------------------------------------
-Bisecting: 337 revisions left to test after this
+Bisecting: 337 revisions left to test after this (roughly 9 steps)
 ------------------------------------------------
 
-You keep repeating this process, compiling the tree, testing it, and
-depending on whether it is good or bad issuing the command "git bisect good"
-or "git bisect bad" to ask for the next bisection.
+Keep repeating the process: compile the tree, test it, and depending
+on whether it is good or bad run `git bisect good` or `git bisect bad`
+to ask for the next commit that needs testing.
+
+Eventually there will be no more revisions left to bisect, and the
+command will print out a description of the first bad commit, and also
+create a reference called `refs/bisect/bad` that points at that
+commit.
 
-Eventually there will be no more revisions left to bisect, and you
-will have been left with the first bad kernel revision in "refs/bisect/bad".
 
 Bisect reset
 ~~~~~~~~~~~~
 
 After a bisect session, to clean up the bisection state and return to
-the original HEAD (i.e., to quit bisecting), issue the following command:
+the original HEAD, issue the following command:
 
 ------------------------------------------------
 $ git bisect reset
@@ -100,61 +115,73 @@ instead:
 $ git bisect reset <commit>
 ------------------------------------------------
 
-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.
+For example, `git bisect reset bisect/bad` will check out the first
+bad revision, while `git bisect reset HEAD` will leave you on the
+current bisection commit and avoid switching commits at all.
+
+
+Alternate terms
+~~~~~~~~~~~~~~~
 
+Sometimes you are not looking for the commit that introduced a
+breakage, but rather for a commit that caused a change between some
+other "old" state and "new" state. For example, you might be looking
+for the commit that introduced a particular fix. Or you might be
+looking for the first commit in which the source-code filenames were
+finally all converted to your company's naming standard. Or whatever.
 
-Alternative terms: bisect new and bisect old
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+In such cases it can be very confusing to use the terms "good" and
+"bad" to refer to "the state before the change" and "the state after
+the change". So instead, you can use the terms "old" and "new",
+respectively, in place of "good" and "bad". (But note that you cannot
+mix "good" and "bad" with "old" and "new" in a single session.)
 
-If you are not at ease with the terms "bad" and "good", perhaps
-because you are looking for the commit that introduced a fix, you can
-alternatively use "new" and "old" instead.
-But note that you cannot mix "bad" and good" with "new" and "old".
+In this more general usage, you provide `git bisect` with a "new"
+commit has some property and an "old" commit that doesn't have that
+property. Each time `git bisect` checks out a commit, you test if that
+commit has the property. If it does, mark the commit as "new";
+otherwise, mark it as "old". When the bisection is done, `git bisect`
+will report which commit introduced the property.
+
+To use "old" and "new" instead of "good" and bad, you must run `git
+bisect start` without commits as argument and then run the following
+commands to add the commits:
 
 ------------------------------------------------
-git bisect new [<rev>]
+git bisect old [<rev>]
 ------------------------------------------------
 
-Marks the commit as new, e.g. "the bug is no longer there", if you are looking
-for a commit that fixed a bug, or "the feature that used to work is now broken
-at this point", if you are looking for a commit that introduced a bug.
-It is the equivalent of "git bisect bad [<rev>]".
+to indicate that a commit was before the sought change, or
 
 ------------------------------------------------
-git bisect old [<rev>...]
+git bisect new [<rev>...]
 ------------------------------------------------
 
-Marks the commit as old, as the opposite of 'git bisect new'.
-It is the equivalent of "git bisect good [<rev>...]".
+to indicate that it was after.
 
-You must run `git bisect start` without commits as argument and run
-`git bisect new <rev>`/`git bisect old <rev>...` after to add the
-commits.
+If you would like to use your own terms instead of "bad"/"good" or
+"new"/"old", you can choose any names you like by typing
 
-Alternative terms: use your own terms
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+------------------------------------------------
+git bisect terms <term-new> <term-old>
+------------------------------------------------
 
-If the builtins terms bad/good and new/old do not satisfy you, you can
-set your own terms.
+before starting a bisection session. For example, if you are looking
+for a commit that introduced a performance regression, you might use
 
 ------------------------------------------------
-git bisect terms <term-new> <term-old>
+git bisect terms slow fast
 ------------------------------------------------
 
-This command has to be used before a bisection has started. <term-new>
-must be associated with the latest revisions and <term-old> with some
-ancestors of <term-new>. For example, if something was buggy in the
-old part of the history, you know somewhere the bug was fixed, and you
-want to find the exact commit that fixed it, you may want to say `git
-bisect terms broken fixed`; this way, you would mark a commit that
-still has the bug with `broken`, and a newer one after the fix with
-`fixed`.
+Or if you are looking for the commit that fixed a bug, you might use
 
-Only the first bisection following the `git bisect terms` will use the
-terms. If you mistyped one of the terms you can do again `git bisect
-terms <term-new> <term-old>`.
+------------------------------------------------
+git bisect terms fixed broken
+------------------------------------------------
+
+If you mistype one of the terms, just run `git bisect terms` again
+with the corrected terms. Only the first bisect session after you run
+`git bisect terms` will use the specified terms.
 
 
 Bisect visualize
@@ -200,17 +227,17 @@ $ git bisect replay that-file
 Avoiding testing a commit
 ~~~~~~~~~~~~~~~~~~~~~~~~~
 
-If, in the middle of a bisect session, you know that the next suggested
-revision is not a good one to test (e.g. the change the commit
-introduces is known not to work in your environment and you know it
-does not have anything to do with the bug you are chasing), you may
-want to find a nearby commit and try that instead.
+If, in the middle of a bisect session, you know that the suggested
+revision is not a good one to test (e.g. it fails to build and you
+know that the failure does not have anything to do with the bug you
+are chasing), you can manually select a nearby commit and test that
+one instead.
 
 For example:
 
 ------------
 $ git bisect good/bad			# previous round was good or bad.
-Bisecting: 337 revisions left to test after this
+Bisecting: 337 revisions left to test after this (roughly 9 steps)
 $ git bisect visualize			# oops, that is uninteresting.
 $ git reset --hard HEAD~3		# try 3 revisions before what
 					# was suggested
@@ -222,18 +249,19 @@ the revision as good or bad in the usual manner.
 Bisect skip
 ~~~~~~~~~~~~
 
-Instead of choosing by yourself a nearby commit, you can ask Git
-to do it for you by issuing the command:
+Instead of choosing a nearby commit by yourself, you can ask Git to do
+it for you by issuing the command:
 
 ------------
 $ git bisect skip                 # Current version cannot be tested
 ------------
 
-But Git may eventually be unable to tell the first bad commit among
-a bad commit and one or more skipped commits.
+However, if you skip a commit adjacent to the one you are looking for,
+Git will be unable to tell exactly which of those commits was the
+first bad one.
 
-You can even skip a range of commits, instead of just one commit,
-using the "'<commit1>'..'<commit2>'" notation. For example:
+You can also skip a range of commits, instead of just one commit,
+using range notation. For example:
 
 ------------
 $ git bisect skip v2.5..v2.6
@@ -249,8 +277,8 @@ would issue the command:
 $ git bisect skip v2.5 v2.5..v2.6
 ------------
 
-This tells the bisect process that the commits between `v2.5` included
-and `v2.6` included should be skipped.
+This tells the bisect process that the commits between `v2.5` and
+`v2.6` (inclusive) should be skipped.
 
 
 Cutting down bisection by giving more parameters to bisect start
@@ -284,14 +312,14 @@ or bad, you can bisect by issuing the command:
 $ git bisect run my_script arguments
 ------------
 
-Note that the script (`my_script` in the above example) should
-exit with code 0 if the current source code is good, and exit with a
-code between 1 and 127 (inclusive), except 125, if the current
-source code is bad.
+Note that the script (`my_script` in the above example) should exit
+with code 0 if the current source code is good/old, and exit with a
+code between 1 and 127 (inclusive), except 125, if the current source
+code is bad/new.
 
 Any other exit code will abort the bisect process. It should be noted
-that a program that terminates via "exit(-1)" leaves $? = 255, (see the
-exit(3) manual page), as the value is chopped with "& 0377".
+that a program that terminates via `exit(-1)` leaves $? = 255, (see the
+exit(3) manual page), as the value is chopped with `& 0377`.
 
 The special exit code 125 should be used when the current source code
 cannot be tested. If the script exits with this code, the current
@@ -300,7 +328,7 @@ as the highest sensible value to use for this purpose, because 126 and 127
 are used by POSIX shells to signal specific error status (127 is for
 command not found, 126 is for command found but not executable---these
 details do not matter, as they are normal errors in the script, as far as
-"bisect run" is concerned).
+`bisect run` is concerned).
 
 You may often find that during a bisect session you want to have
 temporary modifications (e.g. s/#define DEBUG 0/#define DEBUG 1/ in a
@@ -313,7 +341,7 @@ next revision to test, the script can apply the patch
 before compiling, run the real test, and afterwards decide if the
 revision (possibly with the needed patch) passed the test and then
 rewind the tree to the pristine state.  Finally the script should exit
-with the status of the real test to let the "git bisect run" command loop
+with the status of the real test to let the `git bisect run` command loop
 determine the eventual outcome of the bisect session.
 
 OPTIONS
@@ -360,12 +388,12 @@ $ git bisect run ~/test.sh
 $ git bisect reset                   # quit the bisect session
 ------------
 +
-Here we use a "test.sh" custom script. In this script, if "make"
+Here we use a `test.sh` custom script. In this script, if `make`
 fails, we skip the current commit.
-"check_test_case.sh" should "exit 0" if the test case passes,
-and "exit 1" otherwise.
+`check_test_case.sh` should `exit 0` if the test case passes,
+and `exit 1` otherwise.
 +
-It is safer if both "test.sh" and "check_test_case.sh" are
+It is safer if both `test.sh` and `check_test_case.sh` are
 outside the repository to prevent interactions between the bisect,
 make and test processes and the scripts.
 
@@ -432,20 +460,12 @@ In this case, when 'git bisect run' finishes, bisect/bad will refer to a commit
 has at least one parent whose reachable graph is fully traversable in the sense
 required by 'git pack objects'.
 
-* Look for a fix instead of a regression in the code
-+
-------------
-$ git bisect start
-$ git bisect new HEAD    # current commit is marked as new
-$ git bisect old HEAD~10 # the tenth commit from now is marked as old
-------------
-+
-Let's consider the last commit has a given property, and that we are looking
-for the commit which introduced this property. For each commit the bisection
-guide us to, we will test if the property is present. If it is we will mark
-the commit as new with 'git bisect new', otherwise we will mark it as old.
-At the end of the bisect session, the result will be the first new commit (e.g
-the first one with the property).
+
+Getting help
+~~~~~~~~~~~~
+
+Use `git bisect` to get a short usage description, and `git bisect
+help` or `git bisect -h` to get a long usage description.
 
 
 SEE ALSO
-- 
2.1.4

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

* Re: [PATCH] bisect: revise manpage
  2015-06-26 11:30 [PATCH] bisect: revise manpage Michael Haggerty
@ 2015-06-26 12:44 ` Christian Couder
  2015-06-26 13:00   ` Matthieu Moy
  2015-06-26 12:50 ` [PATCH] bisect: revise manpage Matthieu Moy
  1 sibling, 1 reply; 13+ messages in thread
From: Christian Couder @ 2015-06-26 12:44 UTC (permalink / raw)
  To: Michael Haggerty
  Cc: Junio C Hamano, Antoine Delaite, louis--alexandre stuber,
	Christian Couder, Thomas Nguy, Valentin Duperray, Matthieu Moy,
	git

On Fri, Jun 26, 2015 at 1:30 PM, Michael Haggerty <mhagger@alum.mit.edu> wrote:

[...]

> +Eventually there will be no more revisions left to bisect, and the
> +command will print out a description of the first bad commit, and also
> +create a reference called `refs/bisect/bad` that points at that
> +commit.

This could be understood as meaning that `refs/bisect/bad` is created
only at the end of the bisection.

> -Eventually there will be no more revisions left to bisect, and you
> -will have been left with the first bad kernel revision in "refs/bisect/bad".

The original looks better to me in this regard.

Thanks,
Christian.

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

* Re: [PATCH] bisect: revise manpage
  2015-06-26 11:30 [PATCH] bisect: revise manpage Michael Haggerty
  2015-06-26 12:44 ` Christian Couder
@ 2015-06-26 12:50 ` Matthieu Moy
  2015-06-26 14:55   ` Michael Haggerty
  1 sibling, 1 reply; 13+ messages in thread
From: Matthieu Moy @ 2015-06-26 12:50 UTC (permalink / raw)
  To: Michael Haggerty
  Cc: Junio C Hamano, antoine.delaite, louis--alexandre.stuber,
	chriscool, thomasxnguy, valentinduperray, git

Michael Haggerty <mhagger@alum.mit.edu> writes:

> * Remove the "Look for a fix instead of a regression in the code"
>   example, as (1) it was in the "git bisect run" section, but it
>   doesn't use that command, and (2) I think this usage is adequately
>   explained in the "Alternate terms" section.
[...]
> -* Look for a fix instead of a regression in the code
> -+
> -------------
> -$ git bisect start
> -$ git bisect new HEAD    # current commit is marked as new
> -$ git bisect old HEAD~10 # the tenth commit from now is marked as old
> -------------
> -+
> -Let's consider the last commit has a given property, and that we are looking
> -for the commit which introduced this property. For each commit the bisection
> -guide us to, we will test if the property is present. If it is we will mark
> -the commit as new with 'git bisect new', otherwise we will mark it as old.
> -At the end of the bisect session, the result will be the first new commit (e.g
> -the first one with the property).

I disagree with this one: it's in the example section, not bisect run.
The other explanations are nice, but never show the full sequence of
commands so I think an example to sum up does help.

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/

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

* Re: [PATCH] bisect: revise manpage
  2015-06-26 12:44 ` Christian Couder
@ 2015-06-26 13:00   ` Matthieu Moy
  2015-06-26 13:15     ` Christian Couder
  0 siblings, 1 reply; 13+ messages in thread
From: Matthieu Moy @ 2015-06-26 13:00 UTC (permalink / raw)
  To: Christian Couder
  Cc: Michael Haggerty, Junio C Hamano, Antoine Delaite,
	louis--alexandre stuber, Christian Couder, Thomas Nguy,
	Valentin Duperray, git

Christian Couder <christian.couder@gmail.com> writes:

> On Fri, Jun 26, 2015 at 1:30 PM, Michael Haggerty <mhagger@alum.mit.edu> wrote:
>
> [...]
>
>> +Eventually there will be no more revisions left to bisect, and the
>> +command will print out a description of the first bad commit, and also
>> +create a reference called `refs/bisect/bad` that points at that
>> +commit.
>
> This could be understood as meaning that `refs/bisect/bad` is created
> only at the end of the bisection.
>
>> -Eventually there will be no more revisions left to bisect, and you
>> -will have been left with the first bad kernel revision in "refs/bisect/bad".
>
> The original looks better to me in this regard.

I'm changing it to:

Eventually there will be no more revisions left to bisect, and the
command will print out a description of the first bad commit. The
reference `refs/bisect/bad` created by bisect will point at that
commit.

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/

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

* Re: [PATCH] bisect: revise manpage
  2015-06-26 13:00   ` Matthieu Moy
@ 2015-06-26 13:15     ` Christian Couder
  2015-06-26 14:58       ` Michael Haggerty
  0 siblings, 1 reply; 13+ messages in thread
From: Christian Couder @ 2015-06-26 13:15 UTC (permalink / raw)
  To: Matthieu Moy
  Cc: Michael Haggerty, Junio C Hamano, Antoine Delaite,
	louis--alexandre stuber, Christian Couder, Thomas Nguy,
	Valentin Duperray, git

On Fri, Jun 26, 2015 at 3:00 PM, Matthieu Moy
<Matthieu.Moy@grenoble-inp.fr> wrote:
> Christian Couder <christian.couder@gmail.com> writes:
>
>> On Fri, Jun 26, 2015 at 1:30 PM, Michael Haggerty <mhagger@alum.mit.edu> wrote:
>>
>> [...]
>>
>>> +Eventually there will be no more revisions left to bisect, and the
>>> +command will print out a description of the first bad commit, and also
>>> +create a reference called `refs/bisect/bad` that points at that
>>> +commit.
>>
>> This could be understood as meaning that `refs/bisect/bad` is created
>> only at the end of the bisection.
>>
>>> -Eventually there will be no more revisions left to bisect, and you
>>> -will have been left with the first bad kernel revision in "refs/bisect/bad".
>>
>> The original looks better to me in this regard.
>
> I'm changing it to:
>
> Eventually there will be no more revisions left to bisect, and the
> command will print out a description of the first bad commit. The
> reference `refs/bisect/bad` created by bisect will point at that
> commit.

For the last sentence I'd suggest:

The reference called `refs/bisect/bad` will point at that commit.

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

* Re: [PATCH] bisect: revise manpage
  2015-06-26 12:50 ` [PATCH] bisect: revise manpage Matthieu Moy
@ 2015-06-26 14:55   ` Michael Haggerty
  2015-06-26 16:35     ` Matthieu Moy
  2015-06-26 17:54     ` Junio C Hamano
  0 siblings, 2 replies; 13+ messages in thread
From: Michael Haggerty @ 2015-06-26 14:55 UTC (permalink / raw)
  To: Matthieu Moy
  Cc: Junio C Hamano, antoine.delaite, louis--alexandre.stuber,
	chriscool, thomasxnguy, valentinduperray, git

On 06/26/2015 02:50 PM, Matthieu Moy wrote:
> Michael Haggerty <mhagger@alum.mit.edu> writes:
> 
>> * Remove the "Look for a fix instead of a regression in the code"
>>   example, as (1) it was in the "git bisect run" section, but it
>>   doesn't use that command, and (2) I think this usage is adequately
>>   explained in the "Alternate terms" section.
> [...]
>> -* Look for a fix instead of a regression in the code
>> -+
>> -------------
>> -$ git bisect start
>> -$ git bisect new HEAD    # current commit is marked as new
>> -$ git bisect old HEAD~10 # the tenth commit from now is marked as old
>> -------------
>> -+
>> -Let's consider the last commit has a given property, and that we are looking
>> -for the commit which introduced this property. For each commit the bisection
>> -guide us to, we will test if the property is present. If it is we will mark
>> -the commit as new with 'git bisect new', otherwise we will mark it as old.
>> -At the end of the bisect session, the result will be the first new commit (e.g
>> -the first one with the property).
> 
> I disagree with this one: it's in the example section, not bisect run.

Oh yeah, you're right. I mistakenly thought that the examples section
was subsidiary to the `git bisect run` section.

> The other explanations are nice, but never show the full sequence of
> commands so I think an example to sum up does help.

I didn't like this example so much because (1) the code snippet is
pretty trivial, and (2) the explanation afterwards is more of a general
explanation of `git bisect` than a description of this particular
example. (I added text elsewhere that retains the spirit of this
explanation.)

If you want to keep this example, how about making it a little bit more
interesting? Perhaps use `git bisect terms` instead of new/old, and a
little motivational text showing how the alternate names make the
commands clearer? As terms one could maybe use fast/slow and make the
example about benchmark speeds or something?

By the way, when I was revising the text two things occurred to me that
have probably been discussed to death elsewhere but let me mention them
anyway:

1. I found it confusing that `git bisect terms` lists its arguments in
the order `<term-new> <term-old>`. I think that listing them in
"chronological" order would have been a lot more intuitive. But I expect
this choice was made because `git bisect start` takes optional arguments
in that order, so the inconsistency might be worse than the backwardness
of this single command's arguments.

2. When I was describing "old/new", I kept wishing that I could type
"before/after" instead, because those terms seemed to agree better with
the prose description of what "old/new" mean. I wonder if "before/after"
might be better names for commits determined to be before/after the
change being sought?

Oh and I just noticed that `git bisect terms` is missing from the
synopsis at the top of the man page.

Michael

-- 
Michael Haggerty
mhagger@alum.mit.edu

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

* Re: [PATCH] bisect: revise manpage
  2015-06-26 13:15     ` Christian Couder
@ 2015-06-26 14:58       ` Michael Haggerty
  2015-06-26 15:28         ` Christian Couder
                           ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Michael Haggerty @ 2015-06-26 14:58 UTC (permalink / raw)
  To: Christian Couder, Matthieu Moy
  Cc: Junio C Hamano, Antoine Delaite, louis--alexandre stuber,
	Christian Couder, Thomas Nguy, Valentin Duperray, git

On 06/26/2015 03:15 PM, Christian Couder wrote:
> On Fri, Jun 26, 2015 at 3:00 PM, Matthieu Moy
> <Matthieu.Moy@grenoble-inp.fr> wrote:
>> Christian Couder <christian.couder@gmail.com> writes:
>>
>>> On Fri, Jun 26, 2015 at 1:30 PM, Michael Haggerty <mhagger@alum.mit.edu> wrote:
>>>
>>> [...]
>>>
>>>> +Eventually there will be no more revisions left to bisect, and the
>>>> +command will print out a description of the first bad commit, and also
>>>> +create a reference called `refs/bisect/bad` that points at that
>>>> +commit.
>>>
>>> This could be understood as meaning that `refs/bisect/bad` is created
>>> only at the end of the bisection.
>>>
>>>> -Eventually there will be no more revisions left to bisect, and you
>>>> -will have been left with the first bad kernel revision in "refs/bisect/bad".
>>>
>>> The original looks better to me in this regard.
>>
>> I'm changing it to:
>>
>> Eventually there will be no more revisions left to bisect, and the
>> command will print out a description of the first bad commit. The
>> reference `refs/bisect/bad` created by bisect will point at that
>> commit.

I agree that is better.

> For the last sentence I'd suggest:
> 
> The reference called `refs/bisect/bad` will point at that commit.

Or maybe

The reference `refs/bisect/bad` will be left pointing at that commit.

Michael

-- 
Michael Haggerty
mhagger@alum.mit.edu

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

* Re: [PATCH] bisect: revise manpage
  2015-06-26 14:58       ` Michael Haggerty
@ 2015-06-26 15:28         ` Christian Couder
  2015-06-26 16:30           ` Matthieu Moy
  2015-06-26 17:47         ` Junio C Hamano
  2015-06-26 20:22         ` [PATCH v10.1 3/7] Documentation/bisect: revise overall content Matthieu Moy
  2 siblings, 1 reply; 13+ messages in thread
From: Christian Couder @ 2015-06-26 15:28 UTC (permalink / raw)
  To: Michael Haggerty
  Cc: Matthieu Moy, Junio C Hamano, Antoine Delaite,
	louis--alexandre stuber, Christian Couder, Thomas Nguy,
	Valentin Duperray, git

On Fri, Jun 26, 2015 at 4:58 PM, Michael Haggerty <mhagger@alum.mit.edu> wrote:
> On 06/26/2015 03:15 PM, Christian Couder wrote:
>> On Fri, Jun 26, 2015 at 3:00 PM, Matthieu Moy
>> <Matthieu.Moy@grenoble-inp.fr> wrote:
>>> Christian Couder <christian.couder@gmail.com> writes:
>>>
>>>> On Fri, Jun 26, 2015 at 1:30 PM, Michael Haggerty <mhagger@alum.mit.edu> wrote:
>>>>
>>>> [...]
>>>>
>>>>> +Eventually there will be no more revisions left to bisect, and the
>>>>> +command will print out a description of the first bad commit, and also
>>>>> +create a reference called `refs/bisect/bad` that points at that
>>>>> +commit.
>>>>
>>>> This could be understood as meaning that `refs/bisect/bad` is created
>>>> only at the end of the bisection.
>>>>
>>>>> -Eventually there will be no more revisions left to bisect, and you
>>>>> -will have been left with the first bad kernel revision in "refs/bisect/bad".
>>>>
>>>> The original looks better to me in this regard.
>>>
>>> I'm changing it to:
>>>
>>> Eventually there will be no more revisions left to bisect, and the
>>> command will print out a description of the first bad commit. The
>>> reference `refs/bisect/bad` created by bisect will point at that
>>> commit.
>
> I agree that is better.
>
>> For the last sentence I'd suggest:
>>
>> The reference called `refs/bisect/bad` will point at that commit.
>
> Or maybe
>
> The reference `refs/bisect/bad` will be left pointing at that commit.

Yeah ok.

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

* Re: [PATCH] bisect: revise manpage
  2015-06-26 15:28         ` Christian Couder
@ 2015-06-26 16:30           ` Matthieu Moy
  0 siblings, 0 replies; 13+ messages in thread
From: Matthieu Moy @ 2015-06-26 16:30 UTC (permalink / raw)
  To: Christian Couder
  Cc: Michael Haggerty, Junio C Hamano, Antoine Delaite,
	louis--alexandre stuber, Christian Couder, Thomas Nguy,
	Valentin Duperray, git

Christian Couder <christian.couder@gmail.com> writes:

> On Fri, Jun 26, 2015 at 4:58 PM, Michael Haggerty <mhagger@alum.mit.edu> wrote:
>
>> The reference `refs/bisect/bad` will be left pointing at that commit.
>
> Yeah ok.

I took this one.

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/

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

* Re: [PATCH] bisect: revise manpage
  2015-06-26 14:55   ` Michael Haggerty
@ 2015-06-26 16:35     ` Matthieu Moy
  2015-06-26 17:54     ` Junio C Hamano
  1 sibling, 0 replies; 13+ messages in thread
From: Matthieu Moy @ 2015-06-26 16:35 UTC (permalink / raw)
  To: Michael Haggerty
  Cc: Junio C Hamano, antoine.delaite, louis--alexandre.stuber,
	chriscool, thomasxnguy, valentinduperray, git

Michael Haggerty <mhagger@alum.mit.edu> writes:

> I didn't like this example so much because (1) the code snippet is
> pretty trivial, and (2) the explanation afterwards is more of a general
> explanation of `git bisect` than a description of this particular
> example.

I agree that the explanations were redundant. I removed it.

> If you want to keep this example, how about making it a little bit more
> interesting? Perhaps use `git bisect terms` instead of new/old,

I now have both.

> and a little motivational text showing how the alternate names make
> the commands clearer?

Well, actually the motivational text would be essentially what was
already said.

> 1. I found it confusing that `git bisect terms` lists its arguments in
> the order `<term-new> <term-old>`. I think that listing them in
> "chronological" order would have been a lot more intuitive. But I expect
> this choice was made because `git bisect start` takes optional arguments
> in that order, so the inconsistency might be worse than the backwardness
> of this single command's arguments.

Yes, I think keeping the order of 'git bisect start' is good. Junio also
mentionned alphabetic order (bad -> good, new -> old).

> 2. When I was describing "old/new", I kept wishing that I could type
> "before/after" instead, because those terms seemed to agree better with
> the prose description of what "old/new" mean. I wonder if "before/after"
> might be better names for commits determined to be before/after the
> change being sought?

I like old/new essentially because they are very short. I would keep the
code as-is for now, but it's very easy to add a before/after couple of
terms later if needed. If others think before/after are better, it's
still time to change it.

> Oh and I just noticed that `git bisect terms` is missing from the
> synopsis at the top of the man page.

Fixed.

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/

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

* Re: [PATCH] bisect: revise manpage
  2015-06-26 14:58       ` Michael Haggerty
  2015-06-26 15:28         ` Christian Couder
@ 2015-06-26 17:47         ` Junio C Hamano
  2015-06-26 20:22         ` [PATCH v10.1 3/7] Documentation/bisect: revise overall content Matthieu Moy
  2 siblings, 0 replies; 13+ messages in thread
From: Junio C Hamano @ 2015-06-26 17:47 UTC (permalink / raw)
  To: Michael Haggerty
  Cc: Christian Couder, Matthieu Moy, Antoine Delaite,
	louis--alexandre stuber, Christian Couder, Thomas Nguy,
	Valentin Duperray, git

Michael Haggerty <mhagger@alum.mit.edu> writes:

>>> Eventually there will be no more revisions left to bisect, and the
>>> command will print out a description of the first bad commit. The
>>> reference `refs/bisect/bad` created by bisect will point at that
>>> commit.
>
> I agree that is better.
>
>> For the last sentence I'd suggest:
>> 
>> The reference called `refs/bisect/bad` will point at that commit.
>
> Or maybe
>
> The reference `refs/bisect/bad` will be left pointing at that commit.

Sounds good.

I had a trouble with "will be no more reivsions left to bisect",
though.  "left to check" or "left to inspect" I would understand.

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

* Re: [PATCH] bisect: revise manpage
  2015-06-26 14:55   ` Michael Haggerty
  2015-06-26 16:35     ` Matthieu Moy
@ 2015-06-26 17:54     ` Junio C Hamano
  1 sibling, 0 replies; 13+ messages in thread
From: Junio C Hamano @ 2015-06-26 17:54 UTC (permalink / raw)
  To: Michael Haggerty
  Cc: Matthieu Moy, antoine.delaite, louis--alexandre.stuber,
	chriscool, thomasxnguy, valentinduperray, git

Michael Haggerty <mhagger@alum.mit.edu> writes:

> By the way, when I was revising the text two things occurred to me that
> have probably been discussed to death elsewhere but let me mention them
> anyway:
>
> 1. I found it confusing that `git bisect terms` lists its arguments in
> the order `<term-new> <term-old>`. I think that listing them in
> "chronological" order would have been a lot more intuitive. But I expect
> this choice was made because `git bisect start` takes optional arguments
> in that order, so the inconsistency might be worse than the backwardness
> of this single command's arguments.

Consistency with 'start' is truly a good motivaition.  And 'start'
asking for 'bad' first is not backwardness but comes primarily from
syntactic need.  You need one and only one 'bad' and can give zero
or more 'good' to the command, so "start bad [good...]" becomes a
more natural way than "start [good...] bad" to form a command line.

> 2. When I was describing "old/new", I kept wishing that I could type
> "before/after" instead, because those terms seemed to agree better with
> the prose description of what "old/new" mean. I wonder if "before/after"
> might be better names for commits determined to be before/after the
> change being sought?

Yeah, I like that, but I do not think replacing 'old/new' with
'before/after' is worth the trouble.  Both would work equally well
at least for me.

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

* [PATCH v10.1 3/7] Documentation/bisect: revise overall content
  2015-06-26 14:58       ` Michael Haggerty
  2015-06-26 15:28         ` Christian Couder
  2015-06-26 17:47         ` Junio C Hamano
@ 2015-06-26 20:22         ` Matthieu Moy
  2 siblings, 0 replies; 13+ messages in thread
From: Matthieu Moy @ 2015-06-26 20:22 UTC (permalink / raw)
  To: gitster; +Cc: git, Michael Haggerty, Matthieu Moy

From: Michael Haggerty <mhagger@alum.mit.edu>

Thoroughly revise the "git bisect" manpage, including:

* Beef up the "Description" section.

* Make the first long example less specific to kernel development.

* De-emphasize implementation details in a couple of places.

* Add "(roughly N steps)" in the places where example output is shown.

* Properly markup code within the prose.

* Lots of wordsmithing.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
---
Just applied Junio's suggestion: 'no more revision left to inspect'.

 Documentation/git-bisect.txt | 122 ++++++++++++++++++++++++-------------------
 1 file changed, 68 insertions(+), 54 deletions(-)

diff --git a/Documentation/git-bisect.txt b/Documentation/git-bisect.txt
index 2bdc3b8..e97f2de 100644
--- a/Documentation/git-bisect.txt
+++ b/Documentation/git-bisect.txt
@@ -3,7 +3,7 @@ git-bisect(1)
 
 NAME
 ----
-git-bisect - Find by binary search the change that introduced a bug
+git-bisect - Use binary search to find the commit that introduced a bug
 
 
 SYNOPSIS
@@ -16,7 +16,6 @@ DESCRIPTION
 The command takes various subcommands, and different options depending
 on the subcommand:
 
- git bisect help
  git bisect start [--no-checkout] [<bad> [<good>...]] [--] [<paths>...]
  git bisect bad [<rev>]
  git bisect good [<rev>...]
@@ -26,58 +25,71 @@ on the subcommand:
  git bisect replay <logfile>
  git bisect log
  git bisect run <cmd>...
+ git bisect help
 
-This command uses 'git rev-list --bisect' to help drive the
-binary search process to find which change introduced a bug, given an
-old "good" commit object name and a later "bad" commit object name.
+This command uses a binary search algorithm to find which commit in
+your project's history introduced a bug. You use it by first telling
+it a "bad" commit that is known to contain the bug, and a "good"
+commit that is known to be before the bug was introduced. Then `git
+bisect` picks a commit between those two endpoints and asks you
+whether the selected commit is "good" or "bad". It continues narrowing
+down the range until it finds the exact commit that introduced the
+change.
 
 Basic bisect commands: start, bad, good
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-Using the Linux kernel tree as an example, basic use of the bisect
-command is as follows:
+As an example, suppose you are trying to find the commit that broke a
+feature that was known to work in version `v2.6.13-rc2` of your
+project. You start a bisect session as follows:
 
 ------------------------------------------------
 $ git bisect start
 $ git bisect bad                 # Current version is bad
-$ git bisect good v2.6.13-rc2    # v2.6.13-rc2 was the last version
-                                 # tested that was good
+$ git bisect good v2.6.13-rc2    # v2.6.13-rc2 is known to be good
+------------------------------------------------
+
+Once you have specified at least one bad and one good commit, `git
+bisect` selects a commit in the middle of that range of history,
+checks it out, and outputs something similar to the following:
+
+------------------------------------------------
+Bisecting: 675 revisions left to test after this (roughly 10 steps)
 ------------------------------------------------
 
-When you have specified at least one bad and one good version, the
-command bisects the revision tree and outputs something similar to
-the following:
+You should now compile the checked-out version and test it. If that
+version works correctly, type
 
 ------------------------------------------------
-Bisecting: 675 revisions left to test after this
+$ git bisect good
 ------------------------------------------------
 
-The state in the middle of the set of revisions is then checked out.
-You would now compile that kernel and boot it. If the booted kernel
-works correctly, you would then issue the following command:
+If that version is broken, type
 
 ------------------------------------------------
-$ git bisect good			# this one is good
+$ git bisect bad
 ------------------------------------------------
 
-The output of this command would be something similar to the following:
+Then `git bisect` will respond with something like
 
 ------------------------------------------------
-Bisecting: 337 revisions left to test after this
+Bisecting: 337 revisions left to test after this (roughly 9 steps)
 ------------------------------------------------
 
-You keep repeating this process, compiling the tree, testing it, and
-depending on whether it is good or bad issuing the command "git bisect good"
-or "git bisect bad" to ask for the next bisection.
+Keep repeating the process: compile the tree, test it, and depending
+on whether it is good or bad run `git bisect good` or `git bisect bad`
+to ask for the next commit that needs testing.
+
+Eventually there will be no more revisions left to inspect, and the
+command will print out a description of the first bad commit. The
+reference `refs/bisect/bad` will be left pointing at that commit.
 
-Eventually there will be no more revisions left to bisect, and you
-will have been left with the first bad kernel revision in "refs/bisect/bad".
 
 Bisect reset
 ~~~~~~~~~~~~
 
 After a bisect session, to clean up the bisection state and return to
-the original HEAD (i.e., to quit bisecting), issue the following command:
+the original HEAD, issue the following command:
 
 ------------------------------------------------
 $ git bisect reset
@@ -94,9 +106,10 @@ instead:
 $ git bisect reset <commit>
 ------------------------------------------------
 
-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.
+For example, `git bisect reset bisect/bad` will check out the first
+bad revision, while `git bisect reset HEAD` will leave you on the
+current bisection commit and avoid switching commits at all.
+
 
 Bisect visualize
 ~~~~~~~~~~~~~~~~
@@ -141,17 +154,17 @@ $ git bisect replay that-file
 Avoiding testing a commit
 ~~~~~~~~~~~~~~~~~~~~~~~~~
 
-If, in the middle of a bisect session, you know that the next suggested
-revision is not a good one to test (e.g. the change the commit
-introduces is known not to work in your environment and you know it
-does not have anything to do with the bug you are chasing), you may
-want to find a nearby commit and try that instead.
+If, in the middle of a bisect session, you know that the suggested
+revision is not a good one to test (e.g. it fails to build and you
+know that the failure does not have anything to do with the bug you
+are chasing), you can manually select a nearby commit and test that
+one instead.
 
 For example:
 
 ------------
 $ git bisect good/bad			# previous round was good or bad.
-Bisecting: 337 revisions left to test after this
+Bisecting: 337 revisions left to test after this (roughly 9 steps)
 $ git bisect visualize			# oops, that is uninteresting.
 $ git reset --hard HEAD~3		# try 3 revisions before what
 					# was suggested
@@ -163,18 +176,19 @@ the revision as good or bad in the usual manner.
 Bisect skip
 ~~~~~~~~~~~~
 
-Instead of choosing by yourself a nearby commit, you can ask Git
-to do it for you by issuing the command:
+Instead of choosing a nearby commit by yourself, you can ask Git to do
+it for you by issuing the command:
 
 ------------
 $ git bisect skip                 # Current version cannot be tested
 ------------
 
-But Git may eventually be unable to tell the first bad commit among
-a bad commit and one or more skipped commits.
+However, if you skip a commit adjacent to the one you are looking for,
+Git will be unable to tell exactly which of those commits was the
+first bad one.
 
-You can even skip a range of commits, instead of just one commit,
-using the "'<commit1>'..'<commit2>'" notation. For example:
+You can also skip a range of commits, instead of just one commit,
+using range notation. For example:
 
 ------------
 $ git bisect skip v2.5..v2.6
@@ -190,8 +204,8 @@ would issue the command:
 $ git bisect skip v2.5 v2.5..v2.6
 ------------
 
-This tells the bisect process that the commits between `v2.5` included
-and `v2.6` included should be skipped.
+This tells the bisect process that the commits between `v2.5` and
+`v2.6` (inclusive) should be skipped.
 
 
 Cutting down bisection by giving more parameters to bisect start
@@ -225,14 +239,14 @@ or bad, you can bisect by issuing the command:
 $ git bisect run my_script arguments
 ------------
 
-Note that the script (`my_script` in the above example) should
-exit with code 0 if the current source code is good, and exit with a
-code between 1 and 127 (inclusive), except 125, if the current
-source code is bad.
+Note that the script (`my_script` in the above example) should exit
+with code 0 if the current source code is good/old, and exit with a
+code between 1 and 127 (inclusive), except 125, if the current source
+code is bad/new.
 
 Any other exit code will abort the bisect process. It should be noted
-that a program that terminates via "exit(-1)" leaves $? = 255, (see the
-exit(3) manual page), as the value is chopped with "& 0377".
+that a program that terminates via `exit(-1)` leaves $? = 255, (see the
+exit(3) manual page), as the value is chopped with `& 0377`.
 
 The special exit code 125 should be used when the current source code
 cannot be tested. If the script exits with this code, the current
@@ -241,7 +255,7 @@ as the highest sensible value to use for this purpose, because 126 and 127
 are used by POSIX shells to signal specific error status (127 is for
 command not found, 126 is for command found but not executable---these
 details do not matter, as they are normal errors in the script, as far as
-"bisect run" is concerned).
+`bisect run` is concerned).
 
 You may often find that during a bisect session you want to have
 temporary modifications (e.g. s/#define DEBUG 0/#define DEBUG 1/ in a
@@ -254,7 +268,7 @@ next revision to test, the script can apply the patch
 before compiling, run the real test, and afterwards decide if the
 revision (possibly with the needed patch) passed the test and then
 rewind the tree to the pristine state.  Finally the script should exit
-with the status of the real test to let the "git bisect run" command loop
+with the status of the real test to let the `git bisect run` command loop
 determine the eventual outcome of the bisect session.
 
 OPTIONS
@@ -301,12 +315,12 @@ $ git bisect run ~/test.sh
 $ git bisect reset                   # quit the bisect session
 ------------
 +
-Here we use a "test.sh" custom script. In this script, if "make"
+Here we use a `test.sh` custom script. In this script, if `make`
 fails, we skip the current commit.
-"check_test_case.sh" should "exit 0" if the test case passes,
-and "exit 1" otherwise.
+`check_test_case.sh` should `exit 0` if the test case passes,
+and `exit 1` otherwise.
 +
-It is safer if both "test.sh" and "check_test_case.sh" are
+It is safer if both `test.sh` and `check_test_case.sh` are
 outside the repository to prevent interactions between the bisect,
 make and test processes and the scripts.
 
-- 
2.5.0.rc0.7.g0f487ca.dirty

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

end of thread, other threads:[~2015-06-26 20:23 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-26 11:30 [PATCH] bisect: revise manpage Michael Haggerty
2015-06-26 12:44 ` Christian Couder
2015-06-26 13:00   ` Matthieu Moy
2015-06-26 13:15     ` Christian Couder
2015-06-26 14:58       ` Michael Haggerty
2015-06-26 15:28         ` Christian Couder
2015-06-26 16:30           ` Matthieu Moy
2015-06-26 17:47         ` Junio C Hamano
2015-06-26 20:22         ` [PATCH v10.1 3/7] Documentation/bisect: revise overall content Matthieu Moy
2015-06-26 12:50 ` [PATCH] bisect: revise manpage Matthieu Moy
2015-06-26 14:55   ` Michael Haggerty
2015-06-26 16:35     ` Matthieu Moy
2015-06-26 17:54     ` Junio C Hamano

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.