@@ -167,10 +167,6 @@ is_expected_rev() {
167
167
test " $1 " = $( cat " $GIT_DIR /BISECT_EXPECTED_REV" )
168
168
}
169
169
170
- mark_expected_rev () {
171
- echo " $1 " > " $GIT_DIR /BISECT_EXPECTED_REV"
172
- }
173
-
174
170
check_expected_revs () {
175
171
for _rev in " $@ " ; do
176
172
if ! is_expected_rev " $_rev " ; then
@@ -269,132 +265,13 @@ bisect_auto_next() {
269
265
bisect_next_check && bisect_next || :
270
266
}
271
267
272
- bisect_checkout () {
273
- _rev=" $1 "
274
- _msg=" $2 "
275
- echo " Bisecting: $_msg "
276
- mark_expected_rev " $_rev "
277
- git checkout -q " $_rev " -- || exit
278
- git show-branch " $_rev "
279
- }
280
-
281
- is_among () {
282
- _rev=" $1 "
283
- _list=" $2 "
284
- case " $_list " in * $_rev * ) return 0 ;; esac
285
- return 1
286
- }
287
-
288
- handle_bad_merge_base () {
289
- _badmb=" $1 "
290
- _good=" $2 "
291
- if is_expected_rev " $_badmb " ; then
292
- cat >&2 << EOF
293
- The merge base $_badmb is bad.
294
- This means the bug has been fixed between $_badmb and [$_good ].
295
- EOF
296
- exit 3
297
- else
298
- cat >&2 << EOF
299
- Some good revs are not ancestor of the bad rev.
300
- git bisect cannot work properly in this case.
301
- Maybe you mistake good and bad revs?
302
- EOF
303
- exit 1
304
- fi
305
- }
306
-
307
- handle_skipped_merge_base () {
308
- _mb=" $1 "
309
- _bad=" $2 "
310
- _good=" $3 "
311
- cat >&2 << EOF
312
- Warning: the merge base between $_bad and [$_good ] must be skipped.
313
- So we cannot be sure the first bad commit is between $_mb and $_bad .
314
- We continue anyway.
315
- EOF
316
- }
317
-
318
- #
319
- # "check_merge_bases" checks that merge bases are not "bad".
320
- #
321
- # - If one is "good", that's good, we have nothing to do.
322
- # - If one is "bad", it means the user assumed something wrong
323
- # and we must exit.
324
- # - If one is "skipped", we can't know but we should warn.
325
- # - If we don't know, we should check it out and ask the user to test.
326
- #
327
- # In the last case we will return 1, and otherwise 0.
328
- #
329
- check_merge_bases () {
330
- _bad=" $1 "
331
- _good=" $2 "
332
- _skip=" $3 "
333
- for _mb in $( git merge-base --all $_bad $_good )
334
- do
335
- if is_among " $_mb " " $_good " ; then
336
- continue
337
- elif test " $_mb " = " $_bad " ; then
338
- handle_bad_merge_base " $_bad " " $_good "
339
- elif is_among " $_mb " " $_skip " ; then
340
- handle_skipped_merge_base " $_mb " " $_bad " " $_good "
341
- else
342
- bisect_checkout " $_mb " " a merge base must be tested"
343
- return 1
344
- fi
345
- done
346
- return 0
347
- }
348
-
349
- #
350
- # "check_good_are_ancestors_of_bad" checks that all "good" revs are
351
- # ancestor of the "bad" rev.
352
- #
353
- # If that's not the case, we need to check the merge bases.
354
- # If a merge base must be tested by the user we return 1 and
355
- # otherwise 0.
356
- #
357
- check_good_are_ancestors_of_bad () {
358
- test -f " $GIT_DIR /BISECT_ANCESTORS_OK" &&
359
- return
360
-
361
- _bad=" $1 "
362
- _good=$( echo $2 | sed -e ' s/\^//g' )
363
- _skip=" $3 "
364
-
365
- # Bisecting with no good rev is ok
366
- test -z " $_good " && return
367
-
368
- _side=$( git rev-list $_good ^$_bad )
369
- if test -n " $_side " ; then
370
- # Return if a checkout was done
371
- check_merge_bases " $_bad " " $_good " " $_skip " || return
372
- fi
373
-
374
- : > " $GIT_DIR /BISECT_ANCESTORS_OK"
375
-
376
- return 0
377
- }
378
-
379
268
bisect_next () {
380
269
case " $# " in 0) ;; * ) usage ;; esac
381
270
bisect_autostart
382
271
bisect_next_check good
383
272
384
- # Get bad, good and skipped revs
385
- bad=$( git rev-parse --verify refs/bisect/bad) &&
386
- good=$( git for-each-ref --format=' ^%(objectname)' \
387
- " refs/bisect/good-*" | tr ' \012' ' ' ) &&
388
- skip=$( git for-each-ref --format=' %(objectname)' \
389
- " refs/bisect/skip-*" | tr ' \012' ' ' ) || exit
390
-
391
- # Maybe some merge bases must be tested first
392
- check_good_are_ancestors_of_bad " $bad " " $good " " $skip "
393
- # Return now if a checkout has already been done
394
- test " $? " -eq " 1" && return
395
-
396
- # Perform bisection computation, display and checkout
397
- git bisect--helper --next-exit
273
+ # Perform all bisection computation, display and checkout
274
+ git bisect--helper --next-all
398
275
res=$?
399
276
400
277
# Check if we should exit because bisection is finished
0 commit comments