Skip to content

Commit 1273231

Browse files
spearceJunio C Hamano
authored andcommitted
Teach bash how to complete git-cherry-pick.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
1 parent f53352f commit 1273231

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

contrib/completion/git-completion.bash

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,21 @@ _git_checkout ()
269269
COMPREPLY=($(compgen -W "-l -b $(__git_refs)" -- "$cur"))
270270
}
271271

272+
_git_cherry_pick ()
273+
{
274+
local cur="${COMP_WORDS[COMP_CWORD]}"
275+
case "$cur" in
276+
--*)
277+
COMPREPLY=($(compgen -W "
278+
--edit --no-commit
279+
" -- "$cur"))
280+
;;
281+
*)
282+
COMPREPLY=($(compgen -W "$(__git_refs)" -- "$cur"))
283+
;;
284+
esac
285+
}
286+
272287
_git_diff ()
273288
{
274289
__git_complete_file
@@ -472,6 +487,7 @@ _git ()
472487
branch) _git_branch ;;
473488
cat-file) _git_cat_file ;;
474489
checkout) _git_checkout ;;
490+
cherry-pick) _git_cherry_pick ;;
475491
diff) _git_diff ;;
476492
diff-tree) _git_diff_tree ;;
477493
fetch) _git_fetch ;;
@@ -503,6 +519,7 @@ complete -o default -F _gitk gitk
503519
complete -o default -F _git_branch git-branch
504520
complete -o default -o nospace -F _git_cat_file git-cat-file
505521
complete -o default -F _git_checkout git-checkout
522+
complete -o default -F _git_cherry_pick git-cherry-pick
506523
complete -o default -o nospace -F _git_diff git-diff
507524
complete -o default -F _git_diff_tree git-diff-tree
508525
complete -o default -o nospace -F _git_fetch git-fetch

0 commit comments

Comments
 (0)