Merge branch 'jk/http-auth' into maint
[gitweb.git] / contrib / completion / git-completion.bash
index d1a43f9381868d6bf89013f5b2efa63c637374f5..41ee52991d0c1b1fa2a6021133cffecd3ca9deb0 100644 (file)
@@ -936,6 +936,7 @@ _git_apply ()
                        --apply --no-add --exclude=
                        --ignore-whitespace --ignore-space-change
                        --whitespace= --inaccurate-eof --verbose
+                       --recount --directory=
                        "
                return
        esac
@@ -947,13 +948,17 @@ _git_add ()
        --*)
                __gitcomp "
                        --interactive --refresh --patch --update --dry-run
-                       --ignore-errors --intent-to-add
+                       --ignore-errors --intent-to-add --force --edit --chmod=
                        "
                return
        esac
 
-       # XXX should we check for --update and --all options ?
-       __git_complete_index_file "--others --modified --directory --no-empty-directory"
+       local complete_opt="--others --modified --directory --no-empty-directory"
+       if test -n "$(__git_find_on_cmdline "-u --update")"
+       then
+               complete_opt="--modified"
+       fi
+       __git_complete_index_file "$complete_opt"
 }
 
 _git_archive ()
@@ -970,7 +975,7 @@ _git_archive ()
        --*)
                __gitcomp "
                        --format= --list --verbose
-                       --prefix= --remote= --exec=
+                       --prefix= --remote= --exec= --output
                        "
                return
                ;;
@@ -1025,6 +1030,7 @@ _git_branch ()
                        --track --no-track --contains --merged --no-merged
                        --set-upstream-to= --edit-description --list
                        --unset-upstream --delete --move --remotes
+                       --column --no-column --sort= --points-at
                        "
                ;;
        *)
@@ -1138,6 +1144,8 @@ _git_clone ()
                        --single-branch
                        --branch
                        --recurse-submodules
+                       --no-single-branch
+                       --shallow-submodules
                        "
                return
                ;;
@@ -1179,6 +1187,7 @@ _git_commit ()
                        --reset-author --file= --message= --template=
                        --cleanup= --untracked-files --untracked-files=
                        --verbose --quiet --fixup= --squash=
+                       --patch --short --date --allow-empty
                        "
                return
        esac
@@ -1197,7 +1206,7 @@ _git_describe ()
        --*)
                __gitcomp "
                        --all --tags --contains --abbrev= --candidates=
-                       --exact-match --debug --long --match --always
+                       --exact-match --debug --long --match --always --first-parent
                        "
                return
        esac
@@ -1280,6 +1289,7 @@ __git_fetch_recurse_submodules="yes on-demand no"
 __git_fetch_options="
        --quiet --verbose --append --upload-pack --force --keep --depth=
        --tags --no-tags --all --prune --dry-run --recurse-submodules=
+       --unshallow --update-shallow
 "
 
 _git_fetch ()
@@ -1329,7 +1339,7 @@ _git_fsck ()
        --*)
                __gitcomp "
                        --tags --root --unreachable --cache --no-reflogs --full
-                       --strict --verbose --lost-found
+                       --strict --verbose --lost-found --name-objects
                        "
                return
                ;;
@@ -1373,6 +1383,8 @@ _git_grep ()
                        --max-depth
                        --count
                        --and --or --not --all-match
+                       --break --heading --show-function --function-context
+                       --untracked --no-index
                        "
                return
                ;;
@@ -1445,6 +1457,12 @@ _git_ls_files ()
 
 _git_ls_remote ()
 {
+       case "$cur" in
+       --*)
+               __gitcomp "--heads --tags --refs --get-url --symref"
+               return
+               ;;
+       esac
        __gitcomp_nl "$(__git_remotes)"
 }
 
@@ -1566,7 +1584,7 @@ _git_mergetool ()
                return
                ;;
        --*)
-               __gitcomp "--tool="
+               __gitcomp "--tool= --prompt --no-prompt"
                return
                ;;
        esac
@@ -1674,7 +1692,7 @@ _git_pull ()
        __git_complete_remote_or_refspec
 }
 
-__git_push_recurse_submodules="check on-demand"
+__git_push_recurse_submodules="check on-demand only"
 
 __git_complete_force_with_lease ()
 {
@@ -2374,30 +2392,67 @@ _git_config ()
 
 _git_remote ()
 {
-       local subcommands="add rename remove set-head set-branches set-url show prune update"
+       local subcommands="
+               add rename remove set-head set-branches
+               get-url set-url show prune update
+               "
        local subcommand="$(__git_find_on_cmdline "$subcommands")"
        if [ -z "$subcommand" ]; then
-               __gitcomp "$subcommands"
+               case "$cur" in
+               --*)
+                       __gitcomp "--verbose"
+                       ;;
+               *)
+                       __gitcomp "$subcommands"
+                       ;;
+               esac
                return
        fi
 
-       case "$subcommand" in
-       rename|remove|set-url|show|prune)
-               __gitcomp_nl "$(__git_remotes)"
+       case "$subcommand,$cur" in
+       add,--*)
+               __gitcomp "--track --master --fetch --tags --no-tags --mirror="
+               ;;
+       add,*)
+               ;;
+       set-head,--*)
+               __gitcomp "--auto --delete"
+               ;;
+       set-branches,--*)
+               __gitcomp "--add"
                ;;
-       set-head|set-branches)
+       set-head,*|set-branches,*)
                __git_complete_remote_or_refspec
                ;;
-       update)
+       update,--*)
+               __gitcomp "--prune"
+               ;;
+       update,*)
                __gitcomp "$(__git_get_config_variables "remotes")"
                ;;
+       set-url,--*)
+               __gitcomp "--push --add --delete"
+               ;;
+       get-url,--*)
+               __gitcomp "--push --all"
+               ;;
+       prune,--*)
+               __gitcomp "--dry-run"
+               ;;
        *)
+               __gitcomp_nl "$(__git_remotes)"
                ;;
        esac
 }
 
 _git_replace ()
 {
+       case "$cur" in
+       --*)
+               __gitcomp "--edit --graft --format= --list --delete"
+               return
+               ;;
+       esac
        __gitcomp_nl "$(__git_refs)"
 }
 
@@ -2418,7 +2473,7 @@ _git_reset ()
 
        case "$cur" in
        --*)
-               __gitcomp "--merge --mixed --hard --soft --patch"
+               __gitcomp "--merge --mixed --hard --soft --patch --keep"
                return
                ;;
        esac
@@ -2434,7 +2489,10 @@ _git_revert ()
        fi
        case "$cur" in
        --*)
-               __gitcomp "--edit --mainline --no-edit --no-commit --signoff"
+               __gitcomp "
+                       --edit --mainline --no-edit --no-commit --signoff
+                       --strategy= --strategy-option=
+                       "
                return
                ;;
        esac
@@ -2462,7 +2520,7 @@ _git_shortlog ()
                __gitcomp "
                        $__git_log_common_options
                        $__git_log_shortlog_options
-                       --numbered --summary
+                       --numbered --summary --email
                        "
                return
                ;;
@@ -2626,14 +2684,14 @@ _git_svn ()
                        --no-metadata --use-svm-props --use-svnsync-props
                        --log-window-size= --no-checkout --quiet
                        --repack-flags --use-log-author --localtime
+                       --add-author-from
                        --ignore-paths= --include-paths= $remote_opts
                        "
                local init_opts="
                        --template= --shared= --trunk= --tags=
                        --branches= --stdlayout --minimize-url
                        --no-metadata --use-svm-props --use-svnsync-props
-                       --rewrite-root= --prefix= --use-log-author
-                       --add-author-from $remote_opts
+                       --rewrite-root= --prefix= $remote_opts
                        "
                local cmt_opts="
                        --edit --rmdir --find-copies-harder --copy-similarity=
@@ -2740,8 +2798,8 @@ _git_tag ()
        --*)
                __gitcomp "
                        --list --delete --verify --annotate --message --file
-                       --sign --cleanup --local-user --force --column --sort
-                       --contains --points-at
+                       --sign --cleanup --local-user --force --column --sort=
+                       --contains --points-at --merged --no-merged --create-reflog
                        "
                ;;
        esac