@matheusbsbs / matheus-bagliano / commits / 1fd6bec9bc
Fork 0

Teach bash completion about git-shortlog

We've had completion for git-log for quite some time, but just today I noticed we don't have it for the new builtin shortlog that runs git-log internally. This is indeed a handy thing to have completion for, especially when your branch names are of the Very-Very-Long-and-Hard/To-Type/Variety/That-Some-Use. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

Shawn O. Pearce committed May 24, 2007 at 01:25 UTC 1fd6bec9bcb2d7fc710a9866bd53ea52f43d4428
1 file changed +23
contrib/completion/git-completion.bash
+23
@@ -896,6 +896,26 @@ _git_reset ()
896 __gitcomp "$(__git_refs)"
897 }
898
899 +_git_shortlog ()
900 +{
901 + local cur="${COMP_WORDS[COMP_CWORD]}"
902 + case "$cur" in
903 + --*)
904 + __gitcomp "
905 + --max-count= --max-age= --since= --after=
906 + --min-age= --before= --until=
907 + --no-merges
908 + --author= --committer= --grep=
909 + --all-match
910 + --not --all
911 + --numbered --summary
912 + "
913 + return
914 + ;;
915 + esac
916 + __git_complete_revlist
917 +}
918 +
919 _git_show ()
920 {
921 local cur="${COMP_WORDS[COMP_CWORD]}"
@@ -967,6 +987,7 @@ _git ()
987 rebase) _git_rebase ;;
988 remote) _git_remote ;;
989 reset) _git_reset ;;
990 + shortlog) _git_shortlog ;;
991 show) _git_show ;;
992 show-branch) _git_log ;;
993 whatchanged) _git_log ;;
@@ -1012,6 +1033,7 @@ complete -o default -o nospace -F _git_rebase git-rebase
1033 complete -o default -o nospace -F _git_config git-config
1034 complete -o default -o nospace -F _git_remote git-remote
1035 complete -o default -o nospace -F _git_reset git-reset
1036 +complete -o default -o nospace -F _git_shortlog git-shortlog
1037 complete -o default -o nospace -F _git_show git-show
1038 complete -o default -o nospace -F _git_log git-show-branch
1039 complete -o default -o nospace -F _git_log git-whatchanged
@@ -1034,6 +1056,7 @@ complete -o default -o nospace -F _git_merge_base git-merge-base.exe
1056 complete -o default -o nospace -F _git_name_rev git-name-rev.exe
1057 complete -o default -o nospace -F _git_push git-push.exe
1058 complete -o default -o nospace -F _git_config git-config
1059 +complete -o default -o nospace -F _git_shortlog git-shortlog.exe
1060 complete -o default -o nospace -F _git_show git-show.exe
1061 complete -o default -o nospace -F _git_log git-show-branch.exe
1062 complete -o default -o nospace -F _git_log git-whatchanged.exe