@matheusbsbs / matheus-bagliano / commits / bac59f19b1
Fork 0

Documentation: bisect: add a few "git bisect run" examples

Before this patch, there were no "git bisect run" example. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Christian Couder committed May 8, 2008 at 01:00 UTC bac59f19b12af12d59582543fbd77af3f1d06f0c
1 file changed +49
Documentation/git-bisect.txt
+49
@@ -224,6 +224,55 @@ tree to the pristine state. Finally the "run" script can exit with
224 the status of the real test to let "git bisect run" command loop to
225 know the outcome.
226
227 +EXAMPLES
228 +--------
229 +
230 +* Automatically bisect a broken build between v1.2 and HEAD:
231 ++
232 +------------
233 +$ git bisect start HEAD v1.2 -- # HEAD is bad, v1.2 is good
234 +$ git bisect run make # "make" builds the app
235 +------------
236 +
237 +* Automatically bisect a broken test suite:
238 ++
239 +------------
240 +$ cat ~/test.sh
241 +#!/bin/sh
242 +make || exit 125 # this "skip"s broken builds
243 +make test # "make test" runs the test suite
244 +$ git bisect start v1.3 v1.1 -- # v1.3 is bad, v1.1 is good
245 +$ git bisect run ~/test.sh
246 +------------
247 ++
248 +Here we use a "test.sh" custom script. In this script, if "make"
249 +fails, we "skip" the current commit.
250 ++
251 +It's safer to use a custom script outside the repo to prevent
252 +interactions between the bisect, make and test processes and the
253 +script.
254 ++
255 +And "make test" should "exit 0", if the test suite passes, and
256 +"exit 1" (for example) otherwise.
257 +
258 +* Automatically bisect a broken test case:
259 ++
260 +------------
261 +$ cat ~/test.sh
262 +#!/bin/sh
263 +make || exit 125 # this "skip"s broken builds
264 +~/check_test_case.sh # does the test case passes ?
265 +$ git bisect start HEAD HEAD~10 -- # culprit is among the last 10
266 +$ git bisect run ~/test.sh
267 +------------
268 ++
269 +Here "check_test_case.sh" should "exit 0", if the test case passes,
270 +and "exit 1" (for example) otherwise.
271 ++
272 +It's safer if both "test.sh" and "check_test_case.sh" scripts are
273 +outside the repo to prevent interactions between the bisect, make and
274 +test processes and the scripts.
275 +
276 Author
277 ------
278 Written by Linus Torvalds <torvalds@osdl.org>