Skip to content

Commit b2e69f6

Browse files
spearceJunio C Hamano
authored andcommitted
bash: Support git-bisect and its subcommands.
We now offer completion support for git-bisect's subcommands, as well as ref name completion on the good/bad/reset subcommands. This should make interacting with git-bisect slightly easier on the fingers. Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
1 parent 1b71eb3 commit b2e69f6

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

contrib/completion/git-completion.bash

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,35 @@ _git_add ()
407407
COMPREPLY=()
408408
}
409409

410+
_git_bisect ()
411+
{
412+
local i c=1 command
413+
while [ $c -lt $COMP_CWORD ]; do
414+
i="${COMP_WORDS[c]}"
415+
case "$i" in
416+
start|bad|good|reset|visualize|replay|log)
417+
command="$i"
418+
break
419+
;;
420+
esac
421+
c=$((++c))
422+
done
423+
424+
if [ $c -eq $COMP_CWORD -a -z "$command" ]; then
425+
__gitcomp "start bad good reset visualize replay log"
426+
return
427+
fi
428+
429+
case "$command" in
430+
bad|good|reset)
431+
__gitcomp "$(__git_refs)"
432+
;;
433+
*)
434+
COMPREPLY=()
435+
;;
436+
esac
437+
}
438+
410439
_git_branch ()
411440
{
412441
__gitcomp "$(__git_refs)"
@@ -884,6 +913,7 @@ _git ()
884913
am) _git_am ;;
885914
add) _git_add ;;
886915
apply) _git_apply ;;
916+
bisect) _git_bisect ;;
887917
branch) _git_branch ;;
888918
checkout) _git_checkout ;;
889919
cherry) _git_cherry ;;
@@ -928,6 +958,7 @@ complete -o default -o nospace -F _git git
928958
complete -o default -o nospace -F _gitk gitk
929959
complete -o default -o nospace -F _git_am git-am
930960
complete -o default -o nospace -F _git_apply git-apply
961+
complete -o default -o nospace -F _git_bisect git-bisect
931962
complete -o default -o nospace -F _git_branch git-branch
932963
complete -o default -o nospace -F _git_checkout git-checkout
933964
complete -o default -o nospace -F _git_cherry git-cherry

0 commit comments

Comments
 (0)