Code

Merge branch 'js/pick-root'
[git.git] / contrib / completion / git-completion.bash
index 16984632d984006e2f2867a26714086bf3045ca3..27332ed8b1266604594d74b63d806bbaf98f8a88 100755 (executable)
@@ -451,6 +451,18 @@ __git_find_subcommand ()
        done
 }
 
+__git_has_doubledash ()
+{
+       local c=1
+       while [ $c -lt $COMP_CWORD ]; do
+               if [ "--" = "${COMP_WORDS[c]}" ]; then
+                       return 0
+               fi
+               c=$((++c))
+       done
+       return 1
+}
+
 __git_whitespacelist="nowarn warn error error-all strip"
 
 _git_am ()
@@ -497,10 +509,15 @@ _git_apply ()
 
 _git_add ()
 {
+       __git_has_doubledash && return
+
        local cur="${COMP_WORDS[COMP_CWORD]}"
        case "$cur" in
        --*)
-               __gitcomp "--interactive --refresh"
+               __gitcomp "
+                       --interactive --refresh --patch --update --dry-run
+                       --ignore-errors
+                       "
                return
        esac
        COMPREPLY=()
@@ -508,7 +525,9 @@ _git_add ()
 
 _git_bisect ()
 {
-       local subcommands="start bad good reset visualize replay log"
+       __git_has_doubledash && return
+
+       local subcommands="start bad good skip reset visualize replay log run"
        local subcommand="$(__git_find_subcommand "$subcommands")"
        if [ -z "$subcommand" ]; then
                __gitcomp "$subcommands"
@@ -516,7 +535,7 @@ _git_bisect ()
        fi
 
        case "$subcommand" in
-       bad|good|reset)
+       bad|good|reset|skip)
                __gitcomp "$(__git_refs)"
                ;;
        *)
@@ -543,7 +562,7 @@ _git_branch ()
        --*)
                __gitcomp "
                        --color --no-color --verbose --abbrev= --no-abbrev
-                       --track --no-track
+                       --track --no-track --contains --merged --no-merged
                        "
                ;;
        *)
@@ -610,6 +629,8 @@ _git_cherry_pick ()
 
 _git_commit ()
 {
+       __git_has_doubledash && return
+
        local cur="${COMP_WORDS[COMP_CWORD]}"
        case "$cur" in
        --*)
@@ -629,6 +650,8 @@ _git_describe ()
 
 _git_diff ()
 {
+       __git_has_doubledash && return
+
        local cur="${COMP_WORDS[COMP_CWORD]}"
        case "$cur" in
        --*)
@@ -731,6 +754,8 @@ _git_ls_tree ()
 
 _git_log ()
 {
+       __git_has_doubledash && return
+
        local cur="${COMP_WORDS[COMP_CWORD]}"
        case "$cur" in
        --pretty=*)
@@ -758,6 +783,10 @@ _git_log ()
                        --pretty= --name-status --name-only --raw
                        --not --all
                        --left-right --cherry-pick
+                       --graph
+                       --stat --numstat --shortstat
+                       --decorate --diff-filter=
+                       --color-words --walk-reflogs
                        "
                return
                ;;
@@ -1034,7 +1063,6 @@ _git_config ()
                pull.octopus
                pull.twohead
                repack.useDeltaBaseOffset
-               show.difftree
                showbranch.default
                tar.umask
                transfer.unpackLimit
@@ -1043,7 +1071,6 @@ _git_config ()
                user.name
                user.email
                user.signingkey
-               whatchanged.difftree
                branch. remote.
        "
 }
@@ -1081,6 +1108,8 @@ _git_remote ()
 
 _git_reset ()
 {
+       __git_has_doubledash && return
+
        local cur="${COMP_WORDS[COMP_CWORD]}"
        case "$cur" in
        --*)
@@ -1093,6 +1122,8 @@ _git_reset ()
 
 _git_shortlog ()
 {
+       __git_has_doubledash && return
+
        local cur="${COMP_WORDS[COMP_CWORD]}"
        case "$cur" in
        --*)
@@ -1139,6 +1170,8 @@ _git_stash ()
 
 _git_submodule ()
 {
+       __git_has_doubledash && return
+
        local subcommands="add status init update"
        if [ -z "$(__git_find_subcommand "$subcommands")" ]; then
                local cur="${COMP_WORDS[COMP_CWORD]}"
@@ -1345,6 +1378,8 @@ _git ()
 
 _gitk ()
 {
+       __git_has_doubledash && return
+
        local cur="${COMP_WORDS[COMP_CWORD]}"
        local g="$(git rev-parse --git-dir 2>/dev/null)"
        local merge=""