summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorLibravatar Shawn O. Pearce <spearce@spearce.org>2006-11-27 15:12:03 -0500
committerLibravatar Junio C Hamano <junkio@cox.net>2006-11-27 12:57:22 -0800
commit88329195159865c0fcc57a6017c959d13d7a1ad6 (patch)
treef8070e2465856ad5ce651bb8b323350c5b7b1d6c /contrib
parentCache the list of merge strategies and available commands during load. (diff)
downloadtgif-88329195159865c0fcc57a6017c959d13d7a1ad6.tar.xz
Teach bash about git-am/git-apply and their whitespace options.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/completion/git-completion.bash53
1 files changed, 53 insertions, 0 deletions
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 902f80b937..d8ae4d7886 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -307,6 +307,54 @@ __git_aliased_command ()
done
}
+__git_whitespacelist="nowarn warn error error-all strip"
+
+_git_am ()
+{
+ local cur="${COMP_WORDS[COMP_CWORD]}"
+ if [ -d .dotest ]; then
+ COMPREPLY=($(compgen -W "
+ --skip --resolved
+ " -- "$cur"))
+ return
+ fi
+ case "$cur" in
+ --whitespace=*)
+ COMPREPLY=($(compgen -W "$__git_whitespacelist" \
+ -- "${cur##--whitespace=}"))
+ return
+ ;;
+ --*)
+ COMPREPLY=($(compgen -W "
+ --signoff --utf8 --binary --3way --interactive
+ --whitespace=
+ " -- "$cur"))
+ return
+ esac
+ COMPREPLY=()
+}
+
+_git_apply ()
+{
+ local cur="${COMP_WORDS[COMP_CWORD]}"
+ case "$cur" in
+ --whitespace=*)
+ COMPREPLY=($(compgen -W "$__git_whitespacelist" \
+ -- "${cur##--whitespace=}"))
+ return
+ ;;
+ --*)
+ COMPREPLY=($(compgen -W "
+ --stat --numstat --summary --check --index
+ --cached --index-info --reverse --reject --unidiff-zero
+ --apply --no-add --exclude=
+ --whitespace= --inaccurate-eof --verbose
+ " -- "$cur"))
+ return
+ esac
+ COMPREPLY=()
+}
+
_git_branch ()
{
local cur="${COMP_WORDS[COMP_CWORD]}"
@@ -714,6 +762,8 @@ _git ()
[ "$expansion" ] && command="$expansion"
case "$command" in
+ am) _git_am ;;
+ apply) _git_apply ;;
branch) _git_branch ;;
cat-file) _git_cat_file ;;
checkout) _git_checkout ;;
@@ -748,6 +798,8 @@ _gitk ()
complete -o default -o nospace -F _git git
complete -o default -F _gitk gitk
+complete -o default -F _git_am git-am
+complete -o default -F _git_apply git-apply
complete -o default -F _git_branch git-branch
complete -o default -o nospace -F _git_cat_file git-cat-file
complete -o default -F _git_checkout git-checkout
@@ -776,6 +828,7 @@ complete -o default -o nospace -F _git_log git-whatchanged
# included the '.exe' suffix.
#
if [ Cygwin = "$(uname -o 2>/dev/null)" ]; then
+complete -o default -F _git_apply git-apply.exe
complete -o default -o nospace -F _git git.exe
complete -o default -F _git_branch git-branch.exe
complete -o default -o nospace -F _git_cat_file git-cat-file.exe