Skip to content

Commit 4548e85

Browse files
spearceJunio C Hamano
authored andcommitted
Teach bash how to complete long options for git-commit.
Signed-off-by: Shawn O. Pearce <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 0864e3b commit 4548e85

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

contrib/completion/git-completion.bash

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,20 @@ _git_cherry_pick ()
398398
esac
399399
}
400400

401+
_git_commit ()
402+
{
403+
local cur="${COMP_WORDS[COMP_CWORD]}"
404+
case "$cur" in
405+
--*)
406+
COMPREPLY=($(compgen -W "
407+
--all --author= --signoff --verify --no-verify
408+
--edit --amend --include --only
409+
" -- "$cur"))
410+
return
411+
esac
412+
COMPREPLY=()
413+
}
414+
401415
_git_diff ()
402416
{
403417
__git_complete_file
@@ -768,6 +782,7 @@ _git ()
768782
cat-file) _git_cat_file ;;
769783
checkout) _git_checkout ;;
770784
cherry-pick) _git_cherry_pick ;;
785+
commit) _git_commit ;;
771786
diff) _git_diff ;;
772787
diff-tree) _git_diff_tree ;;
773788
fetch) _git_fetch ;;
@@ -804,6 +819,7 @@ complete -o default -F _git_branch git-branch
804819
complete -o default -o nospace -F _git_cat_file git-cat-file
805820
complete -o default -F _git_checkout git-checkout
806821
complete -o default -F _git_cherry_pick git-cherry-pick
822+
complete -o default -F _git_commit git-commit
807823
complete -o default -o nospace -F _git_diff git-diff
808824
complete -o default -F _git_diff_tree git-diff-tree
809825
complete -o default -o nospace -F _git_fetch git-fetch

0 commit comments

Comments
 (0)