22
33USAGE=' [help|start|bad|good|skip|next|reset|visualize|replay|log|run]'
44LONG_USAGE=' git bisect help
5- print this long help message.
5+ print this long help message.
66git bisect start [--no-checkout] [<bad> [<good>...]] [--] [<pathspec>...]
7- reset bisect state and start bisection.
7+ reset bisect state and start bisection.
88git bisect bad [<rev>]
9- mark <rev> a known-bad revision.
9+ mark <rev> a known-bad revision.
1010git bisect good [<rev>...]
11- mark <rev>... known-good revisions.
11+ mark <rev>... known-good revisions.
1212git bisect skip [(<rev>|<range>)...]
13- mark <rev>... untestable revisions.
13+ mark <rev>... untestable revisions.
1414git bisect next
15- find next bisection to test and check it out.
15+ find next bisection to test and check it out.
1616git bisect reset [<commit>]
17- finish bisection search and go back to commit.
17+ finish bisection search and go back to commit.
1818git bisect visualize
19- show bisect status in gitk.
19+ show bisect status in gitk.
2020git bisect replay <logfile>
21- replay bisection log.
21+ replay bisection log.
2222git bisect log
23- show bisect log.
23+ show bisect log.
2424git bisect run <cmd>...
25- use <cmd>... to automatically bisect.
25+ use <cmd>... to automatically bisect.
2626
2727Please use "git help bisect" to get the full man page.'
2828
@@ -55,7 +55,7 @@ bisect_autostart() {
5555 # TRANSLATORS: Make sure to include [Y] and [n] in your
5656 # translation. The program will only accept English input
5757 # at this point.
58- gettext " Do you want me to do it for you [Y/n]? " >&2
58+ gettext " Do you want me to do it for you [Y/n]? " >&2
5959 read yesno
6060 case " $yesno " in
6161 [Nn]* )
@@ -74,38 +74,38 @@ bisect_start() {
7474 #
7575 has_double_dash=0
7676 for arg; do
77- case " $arg " in --) has_double_dash=1; break ;; esac
77+ case " $arg " in --) has_double_dash=1; break ;; esac
7878 done
7979 orig_args=$( git rev-parse --sq-quote " $@ " )
8080 bad_seen=0
8181 eval=' '
8282 mode=' '
8383 while [ $# -gt 0 ]; do
84- arg=" $1 "
85- case " $arg " in
86- --)
87- shift
88- break
84+ arg=" $1 "
85+ case " $arg " in
86+ --)
87+ shift
88+ break
8989 ;;
90- --no-checkout)
91- mode=--no-checkout
92- shift ;;
93- --* )
94- die " $( eval_gettext " unrecognised option: '\$ arg'" ) " ;;
95- * )
96- rev=$( git rev-parse -q --verify " $arg ^{commit}" ) || {
97- test $has_double_dash -eq 1 &&
90+ --no-checkout)
91+ mode=--no-checkout
92+ shift ;;
93+ --* )
94+ die " $( eval_gettext " unrecognised option: '\$ arg'" ) " ;;
95+ * )
96+ rev=$( git rev-parse -q --verify " $arg ^{commit}" ) || {
97+ test $has_double_dash -eq 1 &&
9898 die " $( eval_gettext " '\$ arg' does not appear to be a valid revision" ) "
99- break
100- }
101- case $bad_seen in
102- 0) state=' bad' ; bad_seen=1 ;;
103- * ) state=' good' ;;
99+ break
100+ }
101+ case $bad_seen in
102+ 0) state=' bad' ; bad_seen=1 ;;
103+ * ) state=' good' ;;
104+ esac
105+ eval=" $eval bisect_write '$state ' '$rev ' 'nolog' &&"
106+ shift
107+ ;;
104108 esac
105- eval=" $eval bisect_write '$state ' '$rev ' 'nolog' &&"
106- shift
107- ;;
108- esac
109109 done
110110
111111 #
@@ -207,18 +207,18 @@ check_expected_revs() {
207207}
208208
209209bisect_skip () {
210- all=' '
210+ all=' '
211211 for arg in " $@ "
212212 do
213- case " $arg " in
214- * ..* )
215- revs=$( git rev-list " $arg " ) || die " $( eval_gettext " Bad rev input: \$ arg" ) " ;;
216- * )
217- revs=$( git rev-parse --sq-quote " $arg " ) ;;
218- esac
219- all=" $all $revs "
220- done
221- eval bisect_state ' skip' $all
213+ case " $arg " in
214+ * ..* )
215+ revs=$( git rev-list " $arg " ) || die " $( eval_gettext " Bad rev input: \$ arg" ) " ;;
216+ * )
217+ revs=$( git rev-parse --sq-quote " $arg " ) ;;
218+ esac
219+ all=" $all $revs "
220+ done
221+ eval bisect_state ' skip' $all
222222}
223223
224224bisect_state () {
@@ -316,7 +316,7 @@ bisect_next() {
316316 git bisect--helper --next-all $( test -f " $GIT_DIR /BISECT_HEAD" && echo --no-checkout)
317317 res=$?
318318
319- # Check if we should exit because bisection is finished
319+ # Check if we should exit because bisection is finished
320320 test $res -eq 10 && exit 0
321321
322322 # Check for an error in the bisection process
@@ -355,12 +355,12 @@ bisect_reset() {
355355 case " $# " in
356356 0) branch=$( cat " $GIT_DIR /BISECT_START" ) ;;
357357 1) git rev-parse --quiet --verify " $1 ^{commit}" > /dev/null || {
358- invalid=" $1 "
359- die " $( eval_gettext " '\$ invalid' is not a valid commit" ) "
360- }
361- branch=" $1 " ;;
358+ invalid=" $1 "
359+ die " $( eval_gettext " '\$ invalid' is not a valid commit" ) "
360+ }
361+ branch=" $1 " ;;
362362 * )
363- usage ;;
363+ usage ;;
364364 esac
365365 if ! test -f " $GIT_DIR /BISECT_HEAD"
366366 then
@@ -418,65 +418,65 @@ bisect_replay () {
418418}
419419
420420bisect_run () {
421- bisect_next_check fail
422-
423- while true
424- do
425- command=" $@ "
426- eval_gettext " running \$ command" ; echo
427- " $@ "
428- res=$?
429-
430- # Check for really bad run error.
431- if [ $res -lt 0 -o $res -ge 128 ]; then
432- (
433- eval_gettext " bisect run failed:
421+ bisect_next_check fail
422+
423+ while true
424+ do
425+ command=" $@ "
426+ eval_gettext " running \$ command" ; echo
427+ " $@ "
428+ res=$?
429+
430+ # Check for really bad run error.
431+ if [ $res -lt 0 -o $res -ge 128 ]; then
432+ (
433+ eval_gettext " bisect run failed:
434434exit code \$ res from '\$ command' is < 0 or >= 128" &&
435- echo
436- ) >&2
437- exit $res
438- fi
439-
440- # Find current state depending on run success or failure.
441- # A special exit code of 125 means cannot test.
442- if [ $res -eq 125 ]; then
443- state=' skip'
444- elif [ $res -gt 0 ]; then
445- state=' bad'
446- else
447- state=' good'
448- fi
449-
450- # We have to use a subshell because "bisect_state" can exit.
451- ( bisect_state $state > " $GIT_DIR /BISECT_RUN" )
452- res=$?
453-
454- cat " $GIT_DIR /BISECT_RUN"
455-
456- if sane_grep " first bad commit could be any of" " $GIT_DIR /BISECT_RUN" \
457- > /dev/null; then
458- (
459- gettext " bisect run cannot continue any more" &&
460- echo
461- ) >&2
462- exit $res
463- fi
464-
465- if [ $res -ne 0 ]; then
466- (
467- eval_gettext " bisect run failed:
435+ echo
436+ ) >&2
437+ exit $res
438+ fi
439+
440+ # Find current state depending on run success or failure.
441+ # A special exit code of 125 means cannot test.
442+ if [ $res -eq 125 ]; then
443+ state=' skip'
444+ elif [ $res -gt 0 ]; then
445+ state=' bad'
446+ else
447+ state=' good'
448+ fi
449+
450+ # We have to use a subshell because "bisect_state" can exit.
451+ ( bisect_state $state > " $GIT_DIR /BISECT_RUN" )
452+ res=$?
453+
454+ cat " $GIT_DIR /BISECT_RUN"
455+
456+ if sane_grep " first bad commit could be any of" " $GIT_DIR /BISECT_RUN" \
457+ > /dev/null; then
458+ (
459+ gettext " bisect run cannot continue any more" &&
460+ echo
461+ ) >&2
462+ exit $res
463+ fi
464+
465+ if [ $res -ne 0 ]; then
466+ (
467+ eval_gettext " bisect run failed:
468468'bisect_state \$ state' exited with error code \$ res" &&
469- echo
470- ) >&2
471- exit $res
472- fi
469+ echo
470+ ) >&2
471+ exit $res
472+ fi
473473
474- if sane_grep " is the first bad commit" " $GIT_DIR /BISECT_RUN" > /dev/null; then
475- gettext " bisect run success" ; echo
476- exit 0;
477- fi
474+ if sane_grep " is the first bad commit" " $GIT_DIR /BISECT_RUN" > /dev/null; then
475+ gettext " bisect run success" ; echo
476+ exit 0;
477+ fi
478478
479- done
479+ done
480480}
481481
482482bisect_log () {
@@ -486,33 +486,33 @@ bisect_log () {
486486
487487case " $# " in
4884880)
489- usage ;;
489+ usage ;;
490490* )
491- cmd=" $1 "
492- shift
493- case " $cmd " in
494- help)
495- git bisect -h ;;
496- start)
497- bisect_start " $@ " ;;
498- bad|good)
499- bisect_state " $cmd " " $@ " ;;
500- skip)
501- bisect_skip " $@ " ;;
502- next)
503- # Not sure we want "next" at the UI level anymore.
504- bisect_next " $@ " ;;
505- visualize|view)
506- bisect_visualize " $@ " ;;
507- reset)
508- bisect_reset " $@ " ;;
509- replay)
510- bisect_replay " $@ " ;;
511- log)
512- bisect_log ;;
513- run)
514- bisect_run " $@ " ;;
515- * )
516- usage ;;
517- esac
491+ cmd=" $1 "
492+ shift
493+ case " $cmd " in
494+ help)
495+ git bisect -h ;;
496+ start)
497+ bisect_start " $@ " ;;
498+ bad|good)
499+ bisect_state " $cmd " " $@ " ;;
500+ skip)
501+ bisect_skip " $@ " ;;
502+ next)
503+ # Not sure we want "next" at the UI level anymore.
504+ bisect_next " $@ " ;;
505+ visualize|view)
506+ bisect_visualize " $@ " ;;
507+ reset)
508+ bisect_reset " $@ " ;;
509+ replay)
510+ bisect_replay " $@ " ;;
511+ log)
512+ bisect_log ;;
513+ run)
514+ bisect_run " $@ " ;;
515+ * )
516+ usage ;;
517+ esac
518518esac
0 commit comments