show-branch: migrate to parse-options API
[gitweb.git] / contrib / completion / git-completion.bash
index be591468dbf9314f658721392c5a38a50a4fb6f9..451a97f0788a195e186ad114edb895267a093143 100755 (executable)
@@ -108,10 +108,21 @@ __git_ps1 ()
                        fi
 
                        b="$(git symbolic-ref HEAD 2>/dev/null)" || {
-                               b="$(git describe --exact-match HEAD 2>/dev/null)" ||
+
+                               b="$(
+                               case "${GIT_PS1_DESCRIBE_STYLE-}" in
+                               (contains)
+                                       git describe --contains HEAD ;;
+                               (branch)
+                                       git describe --contains --all HEAD ;;
+                               (describe)
+                                       git describe HEAD ;;
+                               (* | default)
+                                       git describe --exact-match HEAD ;;
+                               esac 2>/dev/null)" ||
+
                                b="$(cut -c1-7 "$g/HEAD" 2>/dev/null)..." ||
                                b="unknown"
-
                                b="($b)"
                        }
                fi
@@ -1354,7 +1365,8 @@ _git_config ()
                __gitcomp "$(__git_merge_strategies)"
                return
                ;;
-       color.branch|color.diff|color.interactive|color.status|color.ui)
+       color.branch|color.diff|color.interactive|\
+       color.showbranch|color.status|color.ui)
                __gitcomp "always never auto"
                return
                ;;
@@ -1499,6 +1511,7 @@ _git_config ()
                color.interactive.help
                color.interactive.prompt
                color.pager
+               color.showbranch
                color.status
                color.status.added
                color.status.changed
@@ -1793,7 +1806,7 @@ _git_show ()
                return
                ;;
        --*)
-               __gitcomp "--pretty= --format=
+               __gitcomp "--pretty= --format= --abbrev-commit --oneline
                        $__git_diff_common_options
                        "
                return
@@ -1810,7 +1823,8 @@ _git_show_branch ()
                __gitcomp "
                        --all --remotes --topo-order --current --more=
                        --list --independent --merge-base --no-name
-                       --sha1-name --topics --reflog
+                       --color --no-color
+                       --sha1-name --sparse --topics --reflog
                        "
                return
                ;;