Code

Merge branch 'py/diff-submodule'
[git.git] / contrib / completion / git-completion.bash
index 2d11d0a97fde69492d25ef31cb517094758e0a16..16984632d984006e2f2867a26714086bf3045ca3 100755 (executable)
@@ -121,13 +121,21 @@ __gitcomp ()
        if [ $# -gt 2 ]; then
                cur="$3"
        fi
-       for c in $1; do
-               case "$c$4" in
-               --*=*) all="$all$c$4$s" ;;
-               *.)    all="$all$c$4$s" ;;
-               *)     all="$all$c$4 $s" ;;
-               esac
-       done
+       case "$cur" in
+       --*=)
+               COMPREPLY=()
+               return
+               ;;
+       *)
+               for c in $1; do
+                       case "$c$4" in
+                       --*=*) all="$all$c$4$s" ;;
+                       *.)    all="$all$c$4$s" ;;
+                       *)     all="$all$c$4 $s" ;;
+                       esac
+               done
+               ;;
+       esac
        IFS=$s
        COMPREPLY=($(compgen -P "$2" -W "$all" -- "$cur"))
        return
@@ -144,7 +152,7 @@ __git_heads ()
                done
                return
        fi
-       for i in $(git-ls-remote "$1" 2>/dev/null); do
+       for i in $(git ls-remote "$1" 2>/dev/null); do
                case "$is_hash,$i" in
                y,*) is_hash=n ;;
                n,*^{}) is_hash=y ;;
@@ -165,7 +173,7 @@ __git_tags ()
                done
                return
        fi
-       for i in $(git-ls-remote "$1" 2>/dev/null); do
+       for i in $(git ls-remote "$1" 2>/dev/null); do
                case "$is_hash,$i" in
                y,*) is_hash=n ;;
                n,*^{}) is_hash=y ;;
@@ -192,7 +200,7 @@ __git_refs ()
                done
                return
        fi
-       for i in $(git-ls-remote "$dir" 2>/dev/null); do
+       for i in $(git ls-remote "$dir" 2>/dev/null); do
                case "$is_hash,$i" in
                y,*) is_hash=n ;;
                n,*^{}) is_hash=y ;;
@@ -215,7 +223,7 @@ __git_refs2 ()
 __git_refs_remotes ()
 {
        local cmd i is_hash=y
-       for i in $(git-ls-remote "$1" 2>/dev/null); do
+       for i in $(git ls-remote "$1" 2>/dev/null); do
                case "$is_hash,$i" in
                n,refs/heads/*)
                        is_hash=y
@@ -631,7 +639,10 @@ _git_diff ()
                        --find-copies-harder --pickaxe-all --pickaxe-regex
                        --text --ignore-space-at-eol --ignore-space-change
                        --ignore-all-space --exit-code --quiet --ext-diff
-                       --no-ext-diff"
+                       --no-ext-diff
+                       --no-prefix --src-prefix= --dst-prefix=
+                       --base --ours --theirs
+                       "
                return
                ;;
        esac
@@ -688,6 +699,7 @@ _git_format_patch ()
                        --full-index --binary
                        --not --all
                        --cover-letter
+                       --no-prefix --src-prefix= --dst-prefix=
                        "
                return
                ;;
@@ -768,7 +780,7 @@ _git_merge ()
                ;;
        --*)
                __gitcomp "
-                       --no-commit --no-summary --squash --strategy
+                       --no-commit --no-stat --log --no-log --squash --strategy
                        "
                return
        esac
@@ -857,7 +869,7 @@ _git_rebase ()
                return
                ;;
        --*)
-               __gitcomp "--onto --merge --strategy"
+               __gitcomp "--onto --merge --strategy --interactive"
                return
        esac
        __gitcomp "$(__git_refs)"
@@ -991,7 +1003,8 @@ _git_config ()
                gitcvs.enabled
                gitcvs.logfile
                gitcvs.allbinary
-               gitcvs.dbname gitcvs.dbdriver gitcvs.dbuser gitcvs.dvpass
+               gitcvs.dbname gitcvs.dbdriver gitcvs.dbuser gitcvs.dbpass
+               gitcvs.dbtablenameprefix
                gc.packrefs
                gc.reflogexpire
                gc.reflogexpireunreachable
@@ -1040,6 +1053,7 @@ _git_remote ()
        local subcommands="add rm show prune update"
        local subcommand="$(__git_find_subcommand "$subcommands")"
        if [ -z "$subcommand" ]; then
+               __gitcomp "$subcommands"
                return
        fi
 
@@ -1332,9 +1346,14 @@ _git ()
 _gitk ()
 {
        local cur="${COMP_WORDS[COMP_CWORD]}"
+       local g="$(git rev-parse --git-dir 2>/dev/null)"
+       local merge=""
+       if [ -f $g/MERGE_HEAD ]; then
+               merge="--merge"
+       fi
        case "$cur" in
        --*)
-               __gitcomp "--not --all"
+               __gitcomp "--not --all $merge"
                return
                ;;
        esac