summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 8763dbb)
raw | patch | inline | side by side (parent: 8763dbb)
author | Junio C Hamano <gitster@pobox.com> | |
Sun, 10 May 2009 08:53:19 +0000 (01:53 -0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sun, 17 May 2009 02:46:31 +0000 (19:46 -0700) |
As I very often work on a detached HEAD, I found it pretty confusing
when __git_ps1() said 'some-name'. Did I create a branch with that name
by mistake, or do I happen to be on a commit with that exact tag?
This patch fixes the issue by enclosing non branch names in a pair of
parentheses when used to substitute %s token in __git_ps1() argument.
It also fixes a small bug where the branch part is left empty when
.git/HEAD is unreadable for whatever reason. The output now says
"(unknown)".
Signed-off-by: Junio C Hamano <gitster@pobox.com>
when __git_ps1() said 'some-name'. Did I create a branch with that name
by mistake, or do I happen to be on a commit with that exact tag?
This patch fixes the issue by enclosing non branch names in a pair of
parentheses when used to substitute %s token in __git_ps1() argument.
It also fixes a small bug where the branch part is left empty when
.git/HEAD is unreadable for whatever reason. The output now says
"(unknown)".
Signed-off-by: Junio C Hamano <gitster@pobox.com>
contrib/completion/git-completion.bash | patch | blob | history |
index c2f8ea3444f932006fbbf9e4f3490c25d15bfe2e..be591468dbf9314f658721392c5a38a50a4fb6f9 100755 (executable)
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