@matheusbsbs / matheus-bagliano / commits / 8832919515
Fork 0

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>

Shawn O. Pearce committed Nov 27, 2006 at 15:12 UTC 88329195159865c0fcc57a6017c959d13d7a1ad6
1 file changed +53
contrib/completion/git-completion.bash
+53
@@ -307,6 +307,54 @@ __git_aliased_command ()
307 done
308 }
309
310 +__git_whitespacelist="nowarn warn error error-all strip"
311 +
312 +_git_am ()
313 +{
314 + local cur="${COMP_WORDS[COMP_CWORD]}"
315 + if [ -d .dotest ]; then
316 + COMPREPLY=($(compgen -W "
317 + --skip --resolved
318 + " -- "$cur"))
319 + return
320 + fi
321 + case "$cur" in
322 + --whitespace=*)
323 + COMPREPLY=($(compgen -W "$__git_whitespacelist" \
324 + -- "${cur##--whitespace=}"))
325 + return
326 + ;;
327 + --*)
328 + COMPREPLY=($(compgen -W "
329 + --signoff --utf8 --binary --3way --interactive
330 + --whitespace=
331 + " -- "$cur"))
332 + return
333 + esac
334 + COMPREPLY=()
335 +}
336 +
337 +_git_apply ()
338 +{
339 + local cur="${COMP_WORDS[COMP_CWORD]}"
340 + case "$cur" in
341 + --whitespace=*)
342 + COMPREPLY=($(compgen -W "$__git_whitespacelist" \
343 + -- "${cur##--whitespace=}"))
344 + return
345 + ;;
346 + --*)
347 + COMPREPLY=($(compgen -W "
348 + --stat --numstat --summary --check --index
349 + --cached --index-info --reverse --reject --unidiff-zero
350 + --apply --no-add --exclude=
351 + --whitespace= --inaccurate-eof --verbose
352 + " -- "$cur"))
353 + return
354 + esac
355 + COMPREPLY=()
356 +}
357 +
358 _git_branch ()
359 {
360 local cur="${COMP_WORDS[COMP_CWORD]}"
@@ -714,6 +762,8 @@ _git ()
762 [ "$expansion" ] && command="$expansion"
763
764 case "$command" in
765 + am) _git_am ;;
766 + apply) _git_apply ;;
767 branch) _git_branch ;;
768 cat-file) _git_cat_file ;;
769 checkout) _git_checkout ;;
@@ -748,6 +798,8 @@ _gitk ()
798
799 complete -o default -o nospace -F _git git
800 complete -o default -F _gitk gitk
801 +complete -o default -F _git_am git-am
802 +complete -o default -F _git_apply git-apply
803 complete -o default -F _git_branch git-branch
804 complete -o default -o nospace -F _git_cat_file git-cat-file
805 complete -o default -F _git_checkout git-checkout
@@ -776,6 +828,7 @@ complete -o default -o nospace -F _git_log git-whatchanged
828 # included the '.exe' suffix.
829 #
830 if [ Cygwin = "$(uname -o 2>/dev/null)" ]; then
831 +complete -o default -F _git_apply git-apply.exe
832 complete -o default -o nospace -F _git git.exe
833 complete -o default -F _git_branch git-branch.exe
834 complete -o default -o nospace -F _git_cat_file git-cat-file.exe