3 USAGE
='[help|start|bad|good|new|old|terms|skip|next|reset|visualize|view|replay|log|run]'
4 LONG_USAGE
='git bisect help
5 print this long help message.
6 git bisect start [--term-{new,bad}=<term> --term-{old,good}=<term>]
7 [--no-checkout] [--first-parent] [<bad> [<good>...]] [--] [<pathspec>...]
8 reset bisect state and start bisection.
9 git bisect (bad|new) [<rev>]
10 mark <rev> a known-bad revision/
11 a revision after change in a given property.
12 git bisect (good|old) [<rev>...]
13 mark <rev>... known-good revisions/
14 revisions before change in a given property.
15 git bisect terms [--term-good | --term-bad]
16 show the terms used for old and new commits (default: bad, good)
17 git bisect skip [(<rev>|<range>)...]
18 mark <rev>... untestable revisions.
20 find next bisection to test and check it out.
21 git bisect reset [<commit>]
22 finish bisection search and go back to commit.
23 git bisect (visualize|view)
24 show bisect status in gitk.
25 git bisect replay <logfile>
29 git bisect run <cmd>...
30 use <cmd>... to automatically bisect.
32 Please use "git help bisect" to get the full man page.'
37 _x40
='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]'
38 _x40
="$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40"
44 if git rev-parse
--verify -q BISECT_HEAD
> /dev
/null
53 git bisect--helper
--bisect-start $@ ||
exit
57 # In case of mistaken revs or checkout error, or signals received,
58 # "bisect_auto_next" below may exit or misbehave.
59 # We have to trap this to be able to clean up using
60 # "bisect_clean_state".
62 trap 'git bisect--helper --bisect-clean-state' 0
63 trap 'exit 255' 1 2 3 15
66 # Check if we can proceed to the next bisect state.
68 git bisect--helper
--bisect-auto-next ||
exit
79 revs
=$
(git rev-list
"$arg") || die
"$(eval_gettext "Bad
rev input
: \
$arg")" ;;
81 revs
=$
(git rev-parse
--sq-quote "$arg") ;;
85 eval bisect_state
'skip' $all
89 git bisect--helper
--bisect-autostart ||
exit
91 git bisect--helper
--check-and-set-terms $state $TERM_GOOD $TERM_BAD ||
exit
95 die
"Please call 'bisect_state' with at least one argument." ;;
96 1,"$TERM_BAD"|
1,"$TERM_GOOD"|
1,skip
)
97 bisected_head
=$
(bisect_head
)
98 rev=$
(git rev-parse
--verify "$bisected_head") ||
99 die
"$(eval_gettext "Bad
rev input
: \
$bisected_head")"
100 git bisect--helper
--bisect-write "$state" "$rev" "$TERM_GOOD" "$TERM_BAD" ||
exit
101 git bisect--helper
--check-expected-revs "$rev" ;;
102 2,"$TERM_BAD"|
*,"$TERM_GOOD"|
*,skip
)
107 sha
=$
(git rev-parse
--verify "$rev^{commit}") ||
108 die
"$(eval_gettext "Bad
rev input
: \
$rev")"
109 hash_list
="$hash_list $sha"
111 for rev in $hash_list
113 git bisect--helper
--bisect-write "$state" "$rev" "$TERM_GOOD" "$TERM_BAD" ||
exit
115 git bisect--helper
--check-expected-revs $hash_list ;;
117 die
"$(eval_gettext "'git bisect \$TERM_BAD' can take only one argument.
")" ;;
121 git bisect--helper
--bisect-auto-next
125 git bisect--helper
--bisect-next-check $TERM_GOOD $TERM_BAD fail ||
exit
129 if test -n "${DISPLAY+set}${SESSIONNAME+set}${MSYSTEM+set}${SECURITYSESSIONID+set}" &&
130 type gitk
>/dev
/null
2>&1
139 -*) set git log
"$@" ;;
144 eval '"$@"' --bisect -- $
(cat "$GIT_DIR/BISECT_NAMES")
149 test "$#" -eq 1 || die
"$(gettext "No logfile given
")"
150 test -r "$file" || die
"$(eval_gettext "cannot
read \
$file for replaying
")"
151 git bisect--helper
--bisect-reset ||
exit
152 oIFS
="$IFS" IFS
="$IFS$(printf '\015')"
153 while read git bisect
command rev tail
155 test "$git $bisect" = "git bisect" ||
test "$git" = "git-bisect" ||
continue
156 if test "$git" = "git-bisect"
162 git bisect--helper
--check-and-set-terms "$command" "$TERM_GOOD" "$TERM_BAD" ||
exit
166 cmd
="bisect_start $rev $tail"
168 "$TERM_GOOD"|
"$TERM_BAD"|skip
)
169 git bisect--helper
--bisect-write "$command" "$rev" "$TERM_GOOD" "$TERM_BAD" ||
exit;;
171 git bisect--helper
--bisect-terms $rev ||
exit;;
173 die
"$(gettext "?? what are you talking about?
")" ;;
177 git bisect--helper
--bisect-auto-next ||
exit
181 git bisect--helper
--bisect-next-check $TERM_GOOD $TERM_BAD fail ||
exit
183 test -n "$*" || die
"$(gettext "bisect run failed
: no
command provided.
")"
188 eval_gettextln
"running \$command"
192 # Check for really bad run error.
193 if [ $res -lt 0 -o $res -ge 128 ]
195 eval_gettextln
"bisect run failed:
196 exit code \$res from '\$command' is < 0 or >= 128" >&2
200 # Find current state depending on run success or failure.
201 # A special exit code of 125 means cannot test.
212 # We have to use a subshell because "bisect_state" can exit.
213 ( bisect_state
$state >"$GIT_DIR/BISECT_RUN" )
216 cat "$GIT_DIR/BISECT_RUN"
218 if sane_grep
"first $TERM_BAD commit could be any of" "$GIT_DIR/BISECT_RUN" \
221 gettextln
"bisect run cannot continue any more" >&2
227 eval_gettextln
"bisect run failed:
228 'bisect_state \$state' exited with error code \$res" >&2
232 if sane_grep
"is the first $TERM_BAD commit" "$GIT_DIR/BISECT_RUN" >/dev
/null
234 gettextln
"bisect run success"
242 test -s "$GIT_DIR/BISECT_LOG" || die
"$(gettext "We are not bisecting.
")"
243 cat "$GIT_DIR/BISECT_LOG"
247 if test -s "$GIT_DIR/BISECT_TERMS"
252 } <"$GIT_DIR/BISECT_TERMS"
268 bad|good|new|old|
"$TERM_BAD"|
"$TERM_GOOD")
269 bisect_state
"$cmd" "$@" ;;
273 # Not sure we want "next" at the UI level anymore.
274 git bisect--helper
--bisect-next "$@" ||
exit ;;
276 bisect_visualize
"$@" ;;
278 git bisect--helper
--bisect-reset "$@" ;;
280 bisect_replay
"$@" ;;
286 git bisect--helper
--bisect-terms "$@" ||
exit;;