Merge branch 'cb/khash-maybe-unused-function'
[gitweb.git] / contrib / completion / git-completion.bash
index dc2b04603dddd274433c6fb34582bba0142f52d1..5f556075d3cbce74c60e81b97d4923a1ff18f78d 100644 (file)
@@ -330,9 +330,32 @@ __gitcomp ()
        case "$cur_" in
        --*=)
                ;;
+       --no-*)
+               local c i=0 IFS=$' \t\n'
+               for c in $1; do
+                       if [[ $c == "--" ]]; then
+                               continue
+                       fi
+                       c="$c${4-}"
+                       if [[ $c == "$cur_"* ]]; then
+                               case $c in
+                               --*=*|*.) ;;
+                               *) c="$c " ;;
+                               esac
+                               COMPREPLY[i++]="${2-}$c"
+                       fi
+               done
+               ;;
        *)
                local c i=0 IFS=$' \t\n'
                for c in $1; do
+                       if [[ $c == "--" ]]; then
+                               c="--no-...${4-}"
+                               if [[ $c == "$cur_"* ]]; then
+                                       COMPREPLY[i++]="${2-}$c "
+                               fi
+                               break
+                       fi
                        c="$c${4-}"
                        if [[ $c == "$cur_"* ]]; then
                                case $c in
@@ -920,6 +943,7 @@ __git_complete_remote_or_refspec ()
                        *) ;;
                        esac
                        ;;
+               --multiple) no_complete_refspec=1; break ;;
                -*) ;;
                *) remote="$i"; break ;;
                esac
@@ -1161,7 +1185,7 @@ _git_am ()
                return
                ;;
        --*)
-               __gitcomp_builtin am "--no-utf8" \
+               __gitcomp_builtin am "" \
                        "$__git_am_inprogress_options"
                return
        esac
@@ -1261,9 +1285,7 @@ _git_branch ()
                __git_complete_refs --cur="${cur##--set-upstream-to=}"
                ;;
        --*)
-               __gitcomp_builtin branch "--no-color --no-abbrev
-                       --no-track --no-column
-                       "
+               __gitcomp_builtin branch
                ;;
        *)
                if [ $only_local_ref = "y" -a $has_r = "n" ]; then
@@ -1304,7 +1326,7 @@ _git_checkout ()
                __gitcomp "diff3 merge" "" "${cur##--conflict=}"
                ;;
        --*)
-               __gitcomp_builtin checkout "--no-track --no-recurse-submodules"
+               __gitcomp_builtin checkout
                ;;
        *)
                # check if --track, --no-track, or --no-guess was specified
@@ -1319,17 +1341,6 @@ _git_checkout ()
        esac
 }
 
-_git_cherry ()
-{
-       case "$cur" in
-       --*)
-               __gitcomp_builtin cherry
-               return
-       esac
-
-       __git_complete_refs
-}
-
 __git_cherry_pick_inprogress_options="--continue --quit --abort"
 
 _git_cherry_pick ()
@@ -1367,7 +1378,7 @@ _git_clone ()
 {
        case "$cur" in
        --*)
-               __gitcomp_builtin clone "--no-single-branch"
+               __gitcomp_builtin clone
                return
                ;;
        esac
@@ -1400,7 +1411,7 @@ _git_commit ()
                return
                ;;
        --*)
-               __gitcomp_builtin commit "--no-edit --verify"
+               __gitcomp_builtin commit
                return
        esac
 
@@ -1503,7 +1514,7 @@ _git_fetch ()
                return
                ;;
        --*)
-               __gitcomp_builtin fetch "--no-tags"
+               __gitcomp_builtin fetch
                return
                ;;
        esac
@@ -1540,7 +1551,7 @@ _git_fsck ()
 {
        case "$cur" in
        --*)
-               __gitcomp_builtin fsck "--no-reflogs"
+               __gitcomp_builtin fsck
                return
                ;;
        esac
@@ -1646,7 +1657,7 @@ _git_ls_files ()
 {
        case "$cur" in
        --*)
-               __gitcomp_builtin ls-files "--no-empty-directory"
+               __gitcomp_builtin ls-files
                return
                ;;
        esac
@@ -1797,12 +1808,7 @@ _git_merge ()
 
        case "$cur" in
        --*)
-               __gitcomp_builtin merge "--no-rerere-autoupdate
-                               --no-commit --no-edit --no-ff
-                               --no-log --no-progress
-                               --no-squash --no-stat
-                               --no-verify-signatures
-                               "
+               __gitcomp_builtin merge
                return
        esac
        __git_complete_refs
@@ -1901,10 +1907,7 @@ _git_pull ()
                return
                ;;
        --*)
-               __gitcomp_builtin pull "--no-autostash --no-commit --no-edit
-                                       --no-ff --no-log --no-progress --no-rebase
-                                       --no-squash --no-stat --no-tags
-                                       --no-verify-signatures"
+               __gitcomp_builtin pull
 
                return
                ;;
@@ -1963,6 +1966,20 @@ _git_push ()
        __git_complete_remote_or_refspec
 }
 
+_git_range_diff ()
+{
+       case "$cur" in
+       --*)
+               __gitcomp "
+                       --creation-factor= --no-dual-color
+                       $__git_diff_common_options
+               "
+               return
+               ;;
+       esac
+       __git_complete_revlist
+}
+
 _git_rebase ()
 {
        __git_find_repo_path
@@ -2095,7 +2112,7 @@ _git_status ()
                return
                ;;
        --*)
-               __gitcomp_builtin status "--no-column"
+               __gitcomp_builtin status
                return
                ;;
        esac
@@ -2345,7 +2362,7 @@ _git_remote ()
 
        case "$subcommand,$cur" in
        add,--*)
-               __gitcomp_builtin remote_add "--no-tags"
+               __gitcomp_builtin remote_add
                ;;
        add,*)
                ;;
@@ -2362,7 +2379,7 @@ _git_remote ()
                __gitcomp_builtin remote_update
                ;;
        update,*)
-               __gitcomp "$(__git_get_config_variables "remotes")"
+               __gitcomp "$(__git_remotes) $(__git_get_config_variables "remotes")"
                ;;
        set-url,--*)
                __gitcomp_builtin remote_set-url
@@ -2425,7 +2442,7 @@ _git_revert ()
        fi
        case "$cur" in
        --*)
-               __gitcomp_builtin revert "--no-edit" \
+               __gitcomp_builtin revert "" \
                        "$__git_revert_inprogress_options"
                return
                ;;
@@ -2495,7 +2512,7 @@ _git_show_branch ()
 {
        case "$cur" in
        --*)
-               __gitcomp_builtin show-branch "--no-color"
+               __gitcomp_builtin show-branch
                return
                ;;
        esac
@@ -2540,6 +2557,9 @@ _git_stash ()
                drop,--*)
                        __gitcomp "--quiet"
                        ;;
+               list,--*)
+                       __gitcomp "--name-status --oneline --patch-with-stat"
+                       ;;
                show,--*|branch,--*)
                        ;;
                branch,*)