Skip to content

Commit 2364259

Browse files
dmellorgitster
authored andcommitted
Documentation: reword the "Description" section of git-bisect.txt.
Reword this section to make it less chatty. Also make minor grammatical fixes. Signed-off-by: David J. Mellor <dmellor@whistlingcat.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 3f7cdf3 commit 2364259

File tree

1 file changed

+77
-77
lines changed

1 file changed

+77
-77
lines changed

Documentation/git-bisect.txt

Lines changed: 77 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ git-bisect(1)
33

44
NAME
55
----
6-
git-bisect - Find the change that introduced a bug by binary search
6+
git-bisect - Find by binary search the change that introduced a bug
77

88

99
SYNOPSIS
@@ -39,7 +39,8 @@ help" or "git bisect -h" to get a long usage description.
3939
Basic bisect commands: start, bad, good
4040
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4141

42-
The way you use it is:
42+
Using the Linux kernel tree as an example, basic use of the bisect
43+
command is as follows:
4344

4445
------------------------------------------------
4546
$ git bisect start
@@ -48,61 +49,62 @@ $ git bisect good v2.6.13-rc2 # v2.6.13-rc2 was the last version
4849
# tested that was good
4950
------------------------------------------------
5051

51-
When you give at least one bad and one good versions, it will bisect
52-
the revision tree and say something like:
52+
When you have specified at least one bad and one good version, the
53+
command bisects the revision tree and outputs something similar to:
5354

5455
------------------------------------------------
5556
Bisecting: 675 revisions left to test after this
5657
------------------------------------------------
5758

58-
and check out the state in the middle. Now, compile that kernel, and
59-
boot it. Now, let's say that this booted kernel works fine, then just
60-
do
59+
and then checks out the state in the middle. You would now compile
60+
that kernel and boot it. If the booted kernel works correctly, you
61+
would then issue the following command:
6162

6263
------------------------------------------------
6364
$ git bisect good # this one is good
6465
------------------------------------------------
6566

66-
which will now say
67+
which would then output something similar to:
6768

6869
------------------------------------------------
6970
Bisecting: 337 revisions left to test after this
7071
------------------------------------------------
7172

7273
and you continue along, compiling that one, testing it, and depending
73-
on whether it is good or bad, you say "git bisect good" or "git bisect
74-
bad", and ask for the next bisection.
74+
on whether it is good or bad issuing the command "git bisect good"
75+
or "git bisect bad" to ask for the next bisection.
7576

76-
Until you have no more left, and you'll have been left with the first
77-
bad kernel rev in "refs/bisect/bad".
77+
Eventually there will be no more revisions left to bisect, and you
78+
will have been left with the first bad kernel revision in "refs/bisect/bad".
7879

7980
Bisect reset
8081
~~~~~~~~~~~~
8182

82-
Oh, and then after you want to reset to the original head, do a
83+
To return to the original head after a bisect session, you issue the
84+
command:
8385

8486
------------------------------------------------
8587
$ git bisect reset
8688
------------------------------------------------
8789

88-
to get back to the original branch, instead of being on the bisection
89-
commit ("git bisect start" will do that for you too, actually: it will
90-
reset the bisection state).
90+
This resets the tree to the original branch instead of being on the
91+
bisection commit ("git bisect start" will also do that, as it resets
92+
the bisection state).
9193

9294
Bisect visualize
9395
~~~~~~~~~~~~~~~~
9496

95-
During the bisection process, you can say
97+
During the bisection process, you issue the command:
9698

9799
------------
98100
$ git bisect visualize
99101
------------
100102

101-
to see the currently remaining suspects in 'gitk'. `visualize` is a bit
102-
too long to type and `view` is provided as a synonym.
103+
to see the currently remaining suspects in 'gitk'. `view` may also
104+
be used as a synonym for `visualize`.
103105

104-
If 'DISPLAY' environment variable is not set, 'git log' is used
105-
instead. You can even give command line options such as `-p` and
106+
If the 'DISPLAY' environment variable is not set, 'git log' is used
107+
instead. You can also give command line options such as `-p` and
106108
`--stat`.
107109

108110
------------
@@ -112,57 +114,56 @@ $ git bisect view --stat
112114
Bisect log and bisect replay
113115
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
114116

115-
The good/bad input is logged, and
117+
The good/bad input is logged, and:
116118

117119
------------
118120
$ git bisect log
119121
------------
120122

121123
shows what you have done so far. You can truncate its output somewhere
122-
and save it in a file, and run
124+
and save it in a file, and run:
123125

124126
------------
125127
$ git bisect replay that-file
126128
------------
127129

128-
if you find later you made a mistake telling good/bad about a
129-
revision.
130+
if you find later that you made a mistake specifying revisions as good/bad.
130131

131-
Avoiding to test a commit
132+
Avoiding testing a commit
132133
~~~~~~~~~~~~~~~~~~~~~~~~~
133134

134-
If in a middle of bisect session, you know what the bisect suggested
135-
to try next is not a good one to test (e.g. the change the commit
135+
If in the middle of a bisect session, you know that the next suggested
136+
revision is not a good one to test (e.g. the change the commit
136137
introduces is known not to work in your environment and you know it
137138
does not have anything to do with the bug you are chasing), you may
138-
want to find a near-by commit and try that instead.
139+
want to find a nearby commit and try that instead.
139140

140-
It goes something like this:
141+
For example:
141142

142143
------------
143144
$ git bisect good/bad # previous round was good/bad.
144145
Bisecting: 337 revisions left to test after this
145146
$ git bisect visualize # oops, that is uninteresting.
146-
$ git reset --hard HEAD~3 # try 3 revs before what
147+
$ git reset --hard HEAD~3 # try 3 revisions before what
147148
# was suggested
148149
------------
149150

150-
Then compile and test the one you chose to try. After that, tell
151-
bisect what the result was as usual.
151+
Then compile and test the chosen revision. Afterwards the revision
152+
is marked as good/bad in the usual manner.
152153

153154
Bisect skip
154155
~~~~~~~~~~~~
155156

156-
Instead of choosing by yourself a nearby commit, you may just want git
157-
to do it for you using:
157+
Instead of choosing by yourself a nearby commit, you can ask git
158+
to do it for you by issuing the command:
158159

159160
------------
160161
$ git bisect skip # Current version cannot be tested
161162
------------
162163

163164
But computing the commit to test may be slower afterwards and git may
164-
eventually not be able to tell the first bad among a bad and one or
165-
more "skip"ped commits.
165+
eventually not be able to tell the first bad commit among a bad commit
166+
and one or more skipped commits.
166167

167168
You can even skip a range of commits, instead of just one commit,
168169
using the "'<commit1>'..'<commit2>'" notation. For example:
@@ -174,30 +175,29 @@ $ git bisect skip v2.5..v2.6
174175
would mean that no commit between `v2.5` excluded and `v2.6` included
175176
can be tested.
176177

177-
Note that if you want to also skip the first commit of a range you can
178-
use something like:
178+
Note that if you also want to skip the first commit of the range you
179+
would issue the command:
179180

180181
------------
181182
$ git bisect skip v2.5 v2.5..v2.6
182183
------------
183184

184-
and the commit pointed to by `v2.5` will be skipped too.
185+
and the commit pointed to by `v2.5` would also be skipped.
185186

186187
Cutting down bisection by giving more parameters to bisect start
187188
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
188189

189-
You can further cut down the number of trials if you know what part of
190-
the tree is involved in the problem you are tracking down, by giving
191-
paths parameters when you say `bisect start`, like this:
190+
You can further cut down the number of trials, if you know what part of
191+
the tree is involved in the problem you are tracking down, by specifying
192+
path parameters when issuing the `bisect start` command, like this:
192193

193194
------------
194195
$ git bisect start -- arch/i386 include/asm-i386
195196
------------
196197

197-
If you know beforehand more than one good commits, you can narrow the
198-
bisect space down without doing the whole tree checkout every time you
199-
give good commits. You give the bad revision immediately after `start`
200-
and then you give all the good revisions you have:
198+
If you know beforehand more than one good commit, you can narrow the
199+
bisect space down by specifying all of the good commits immediately after
200+
the bad commit when issuing the `bisect start` command:
201201

202202
------------
203203
$ git bisect start v2.6.20-rc6 v2.6.20-rc4 v2.6.20-rc1 --
@@ -209,38 +209,38 @@ Bisect run
209209
~~~~~~~~~~
210210

211211
If you have a script that can tell if the current source code is good
212-
or bad, you can automatically bisect using:
212+
or bad, you can bisect by issuing the command:
213213

214214
------------
215215
$ git bisect run my_script
216216
------------
217217

218-
Note that the "run" script (`my_script` in the above example) should
219-
exit with code 0 in case the current source code is good. Exit with a
218+
Note that the script (`my_script` in the above example) should
219+
exit with code 0 if the current source code is good, and exit with a
220220
code between 1 and 127 (inclusive), except 125, if the current
221221
source code is bad.
222222

223-
Any other exit code will abort the automatic bisect process. (A
224-
program that does "exit(-1)" leaves $? = 255, see exit(3) manual page,
225-
the value is chopped with "& 0377".)
223+
Any other exit code will abort the bisect process. It should be noted
224+
that a program that terminates via "exit(-1)" leaves $? = 255, (see the
225+
exit(3) manual page), as the value is chopped with "& 0377".
226226

227227
The special exit code 125 should be used when the current source code
228-
cannot be tested. If the "run" script exits with this code, the current
229-
revision will be skipped, see `git bisect skip` above.
228+
cannot be tested. If the script exits with this code, the current
229+
revision will be skipped (see `git bisect skip` above).
230230

231-
You may often find that during bisect you want to have near-constant
232-
tweaks (e.g., s/#define DEBUG 0/#define DEBUG 1/ in a header file, or
233-
"revision that does not have this commit needs this patch applied to
234-
work around other problem this bisection is not interested in")
235-
applied to the revision being tested.
231+
You may often find that during a bisect session you want to have
232+
temporary modifications (e.g. s/#define DEBUG 0/#define DEBUG 1/ in a
233+
header file, or "revision that does not have this commit needs this
234+
patch applied to work around another problem this bisection is not
235+
interested in") applied to the revision being tested.
236236

237237
To cope with such a situation, after the inner 'git bisect' finds the
238-
next revision to test, with the "run" script, you can apply that tweak
239-
before compiling, run the real test, and after the test decides if the
240-
revision (possibly with the needed tweaks) passed the test, rewind the
241-
tree to the pristine state. Finally the "run" script can exit with
242-
the status of the real test to let the "git bisect run" command loop to
243-
determine the outcome.
238+
next revision to test, the script can apply the patch
239+
before compiling, run the real test, and afterwards decide if the
240+
revision (possibly with the needed patch) passed the test and then
241+
rewind the tree to the pristine state. Finally the script should exit
242+
with the status of the real test to let the "git bisect run" command loop
243+
to determine the eventual outcome of the bisect session.
244244

245245
EXAMPLES
246246
--------
@@ -257,39 +257,39 @@ $ git bisect run make # "make" builds the app
257257
------------
258258
$ cat ~/test.sh
259259
#!/bin/sh
260-
make || exit 125 # this "skip"s broken builds
260+
make || exit 125 # this skips broken builds
261261
make test # "make test" runs the test suite
262262
$ git bisect start v1.3 v1.1 -- # v1.3 is bad, v1.1 is good
263263
$ git bisect run ~/test.sh
264264
------------
265265
+
266266
Here we use a "test.sh" custom script. In this script, if "make"
267-
fails, we "skip" the current commit.
267+
fails, we skip the current commit.
268268
+
269-
It's safer to use a custom script outside the repo to prevent
269+
It is safer to use a custom script outside the repository to prevent
270270
interactions between the bisect, make and test processes and the
271271
script.
272272
+
273-
And "make test" should "exit 0", if the test suite passes, and
274-
"exit 1" (for example) otherwise.
273+
"make test" should "exit 0", if the test suite passes, and
274+
"exit 1" otherwise.
275275

276276
* Automatically bisect a broken test case:
277277
+
278278
------------
279279
$ cat ~/test.sh
280280
#!/bin/sh
281-
make || exit 125 # this "skip"s broken builds
281+
make || exit 125 # this skips broken builds
282282
~/check_test_case.sh # does the test case passes ?
283283
$ git bisect start HEAD HEAD~10 -- # culprit is among the last 10
284284
$ git bisect run ~/test.sh
285285
------------
286286
+
287-
Here "check_test_case.sh" should "exit 0", if the test case passes,
288-
and "exit 1" (for example) otherwise.
287+
Here "check_test_case.sh" should "exit 0" if the test case passes,
288+
and "exit 1" otherwise.
289289
+
290-
It's safer if both "test.sh" and "check_test_case.sh" scripts are
291-
outside the repo to prevent interactions between the bisect, make and
292-
test processes and the scripts.
290+
It is safer if both "test.sh" and "check_test_case.sh" scripts are
291+
outside the repository to prevent interactions between the bisect,
292+
make and test processes and the scripts.
293293

294294
Author
295295
------

0 commit comments

Comments
 (0)