Merge branch 'sb/maint-1.6.2-opt-filename-fix' into maint
[gitweb.git] / contrib / completion / git-completion.bash
index be591468dbf9314f658721392c5a38a50a4fb6f9..f44152c4331bb6a2de764e6dcc98c1ac39e517e5 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
@@ -121,7 +132,7 @@ __git_ps1 ()
                local c
 
                if [ "true" = "$(git rev-parse --is-inside-git-dir 2>/dev/null)" ]; then
-                       if [ "true" = "$(git config --bool core.bare 2>/dev/null)" ]; then
+                       if [ "true" = "$(git rev-parse --is-bare-repository 2>/dev/null)" ]; then
                                c="BARE:"
                        else
                                b="GIT_DIR!"
@@ -1793,7 +1804,7 @@ _git_show ()
                return
                ;;
        --*)
-               __gitcomp "--pretty= --format=
+               __gitcomp "--pretty= --format= --abbrev-commit --oneline
                        $__git_diff_common_options
                        "
                return
@@ -1810,7 +1821,7 @@ _git_show_branch ()
                __gitcomp "
                        --all --remotes --topo-order --current --more=
                        --list --independent --merge-base --no-name
-                       --sha1-name --topics --reflog
+                       --sha1-name --sparse --topics --reflog
                        "
                return
                ;;