Merge branch 'jn/gitweb-customlinks'
[gitweb.git] / contrib / completion / git-completion.bash
index 93f088189e6b65e03eddea9013273f0559837d26..de193ba7c1caf69367410d763f3541555a64746f 100755 (executable)
@@ -785,14 +785,9 @@ _git_fetch ()
 {
        local cur="${COMP_WORDS[COMP_CWORD]}"
 
-       case "${COMP_WORDS[0]},$COMP_CWORD" in
-       git-fetch*,1)
+       if [ "$COMP_CWORD" = 2 ]; then
                __gitcomp "$(__git_remotes)"
-               ;;
-       git,2)
-               __gitcomp "$(__git_remotes)"
-               ;;
-       *)
+       else
                case "$cur" in
                *:*)
                        local pfx=""
@@ -811,8 +806,7 @@ _git_fetch ()
                        __gitcomp "$(__git_refs2 "$remote")"
                        ;;
                esac
-               ;;
-       esac
+       fi
 }
 
 _git_format_patch ()
@@ -887,6 +881,7 @@ _git_help ()
                attributes cli core-tutorial cvs-migration
                diffcore gitk glossary hooks ignore modules
                repository-layout tutorial tutorial-2
+               workflows
                "
 }
 
@@ -1049,36 +1044,25 @@ _git_pull ()
 {
        local cur="${COMP_WORDS[COMP_CWORD]}"
 
-       case "${COMP_WORDS[0]},$COMP_CWORD" in
-       git-pull*,1)
-               __gitcomp "$(__git_remotes)"
-               ;;
-       git,2)
+       if [ "$COMP_CWORD" = 2 ]; then
                __gitcomp "$(__git_remotes)"
-               ;;
-       *)
+       else
                local remote
                case "${COMP_WORDS[0]}" in
                git-pull)  remote="${COMP_WORDS[1]}" ;;
                git)       remote="${COMP_WORDS[2]}" ;;
                esac
                __gitcomp "$(__git_refs "$remote")"
-               ;;
-       esac
+       fi
 }
 
 _git_push ()
 {
        local cur="${COMP_WORDS[COMP_CWORD]}"
 
-       case "${COMP_WORDS[0]},$COMP_CWORD" in
-       git-push*,1)
+       if [ "$COMP_CWORD" = 2 ]; then
                __gitcomp "$(__git_remotes)"
-               ;;
-       git,2)
-               __gitcomp "$(__git_remotes)"
-               ;;
-       *)
+       else
                case "$cur" in
                *:*)
                        local remote
@@ -1102,8 +1086,7 @@ _git_push ()
                        __gitcomp "$(__git_refs)"
                        ;;
                esac
-               ;;
-       esac
+       fi
 }
 
 _git_rebase ()
@@ -1141,7 +1124,8 @@ _git_send_email ()
                        --no-suppress-from --no-thread --quiet
                        --signed-off-by-cc --smtp-pass --smtp-server
                        --smtp-server-port --smtp-ssl --smtp-user --subject
-                       --suppress-cc --suppress-from --thread --to"
+                       --suppress-cc --suppress-from --thread --to
+                       --validate --no-validate"
                return
                ;;
        esac
@@ -1414,6 +1398,8 @@ _git_shortlog ()
 
 _git_show ()
 {
+       __git_has_doubledash && return
+
        local cur="${COMP_WORDS[COMP_CWORD]}"
        case "$cur" in
        --pretty=*)