summaryrefslogtreecommitdiff
path: root/contrib/completion/git-completion.bash
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/completion/git-completion.bash')
-rwxr-xr-xcontrib/completion/git-completion.bash15
1 files changed, 8 insertions, 7 deletions
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index c2f8ea3..be59146 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -106,13 +106,14 @@ __git_ps1 ()
if [ -f "$g/BISECT_LOG" ]; then
r="|BISECTING"
fi
- if ! b="$(git symbolic-ref HEAD 2>/dev/null)"; then
- if ! b="$(git describe --exact-match HEAD 2>/dev/null)"; then
- if [ -r "$g/HEAD" ]; then
- b="$(cut -c1-7 "$g/HEAD")..."
- fi
- fi
- fi
+
+ b="$(git symbolic-ref HEAD 2>/dev/null)" || {
+ b="$(git describe --exact-match HEAD 2>/dev/null)" ||
+ b="$(cut -c1-7 "$g/HEAD" 2>/dev/null)..." ||
+ b="unknown"
+
+ b="($b)"
+ }
fi
local w