Teach bash the new features of 'git show'.
Now that 'git show' accepts ref:path as an argument to specify a tree or blob we should use the same completion logic as we support for cat-file's object identifier. Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
Shawn O. Pearce committed
Dec 15, 2006 at 02:20 UTC
9013192449ed1148da4805e33a2644fca92dd1c7
1 file changed
+21
-3
contrib/completion/git-completion.bash
+21
-3
@@ -752,6 +752,24 @@ _git_reset ()
752
COMPREPLY=($(compgen -W "$opt $(__git_refs)" -- "$cur"))
753
}
754
755
+_git_show ()
756
+{
757
+ local cur="${COMP_WORDS[COMP_CWORD]}"
758
+ case "$cur" in
759
+ --pretty=*)
760
+ COMPREPLY=($(compgen -W "
761
+ oneline short medium full fuller email raw
762
+ " -- "${cur##--pretty=}"))
763
+ return
764
+ ;;
765
+ --*)
766
+ COMPREPLY=($(compgen -W "--pretty=" -- "$cur"))
767
+ return
768
+ ;;
769
+ esac
770
+ __git_complete_file
771
+}
772
+
773
_git ()
774
{
775
local i c=1 command __git_dir
@@ -802,7 +820,7 @@ _git ()
820
rebase) _git_rebase ;;
821
repo-config) _git_repo_config ;;
822
reset) _git_reset ;;
805
- show) _git_log ;;
823
+ show) _git_show ;;
824
show-branch) _git_log ;;
825
whatchanged) _git_log ;;
826
*) COMPREPLY=() ;;
@@ -839,7 +857,7 @@ complete -o default -o nospace -F _git_push git-push
857
complete -o default -F _git_rebase git-rebase
858
complete -o default -F _git_repo_config git-repo-config
859
complete -o default -F _git_reset git-reset
842
-complete -o default -F _git_log git-show
860
+complete -o default -o nospace -F _git_show git-show
861
complete -o default -o nospace -F _git_log git-show-branch
862
complete -o default -o nospace -F _git_log git-whatchanged
863
@@ -861,7 +879,7 @@ complete -o default -F _git_merge_base git-merge-base.exe
879
complete -o default -F _git_name_rev git-name-rev.exe
880
complete -o default -o nospace -F _git_push git-push.exe
881
complete -o default -F _git_repo_config git-repo-config
864
-complete -o default -o nospace -F _git_log git-show.exe
882
+complete -o default -o nospace -F _git_show git-show.exe
883
complete -o default -o nospace -F _git_log git-show-branch.exe
884
complete -o default -o nospace -F _git_log git-whatchanged.exe
885
fi