Add bare repository indicator for __git_ps1
Prefixes the branch name with "BARE:" if you're in a bare repository. Signed-off-by: Marius Storm-Olsen <git@storm-olsen.com> Acked-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Marius Storm-Olsen committed
Feb 21, 2009 at 15:48 UTC
f50edca56c40cbfe48734eacd5d79416ba3649eb
1 file changed
+8
-2
contrib/completion/git-completion.bash
+8
-2
@@ -135,11 +135,17 @@ __git_ps1 ()
135
fi
136
fi
137
138
+ local c
139
+
140
+ if [ "true" = "$(git config --bool core.bare 2>/dev/null)" ]; then
141
+ c="BARE:"
142
+ fi
143
+
144
if [ -n "$b" ]; then
145
if [ -n "${1-}" ]; then
140
- printf "$1" "${b##refs/heads/}$w$i$r"
146
+ printf "$1" "$c${b##refs/heads/}$w$i$r"
147
else
142
- printf " (%s)" "${b##refs/heads/}$w$i$r"
148
+ printf " (%s)" "$c${b##refs/heads/}$w$i$r"
149
fi
150
fi
151
fi