Merge branch 'as/test-cleanup'
[gitweb.git] / contrib / completion / git-completion.bash
index 9cd58ca45dc182e78c1b687d5d1f5ef87cc87b8f..8c49ce25443c531fb11243d8faf19010a209e970 100644 (file)
@@ -290,7 +290,7 @@ __git_refs ()
                                if [[ "$ref" == "$cur"* ]]; then
                                        echo "$ref"
                                fi
-                       done | uniq -u
+                       done | sort | uniq -u
                fi
                return
        fi
@@ -397,7 +397,7 @@ __git_complete_revlist_file ()
                *)   pfx="$ref:$pfx" ;;
                esac
 
-               __gitcomp_nl "$(git --git-dir="$(__gitdir)" ls-tree "$ls" \
+               __gitcomp_nl "$(git --git-dir="$(__gitdir)" ls-tree "$ls" 2>/dev/null \
                                | sed '/^100... blob /{
                                           s,^.*        ,,
                                           s,$, ,
@@ -554,7 +554,7 @@ __git_list_porcelain_commands ()
 {
        local i IFS=" "$'\n'
        __git_compute_all_commands
-       for i in "help" $__git_all_commands
+       for i in $__git_all_commands
        do
                case $i in
                *--*)             : helper pattern;;
@@ -563,6 +563,7 @@ __git_list_porcelain_commands ()
                archimport)       : import;;
                cat-file)         : plumbing;;
                check-attr)       : plumbing;;
+               check-ignore)     : plumbing;;
                check-ref-format) : plumbing;;
                checkout-index)   : plumbing;;
                commit-tree)      : plumbing;;
@@ -958,6 +959,8 @@ _git_clone ()
                        --upload-pack
                        --template=
                        --depth
+                       --single-branch
+                       --branch
                        "
                return
                ;;
@@ -969,6 +972,13 @@ _git_commit ()
 {
        __git_has_doubledash && return
 
+       case "$prev" in
+       -c|-C)
+               __gitcomp_nl "$(__git_refs)" "" "${cur}"
+               return
+               ;;
+       esac
+
        case "$cur" in
        --cleanup=*)
                __gitcomp "default strip verbatim whitespace
@@ -2402,6 +2412,8 @@ __gitk_main ()
 if [[ -n ${ZSH_VERSION-} ]]; then
        echo "WARNING: this script is deprecated, please see git-completion.zsh" 1>&2
 
+       autoload -U +X compinit && compinit
+
        __gitcomp ()
        {
                emulate -L zsh
@@ -2420,7 +2432,7 @@ if [[ -n ${ZSH_VERSION-} ]]; then
                                --*=*|*.) ;;
                                *) c="$c " ;;
                                esac
-                               array+=("$c")
+                               array[$#array+1]="$c"
                        done
                        compset -P '*[=:]'
                        compadd -Q -S '' -p "${2-}" -a -- array && _ret=0