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>
This commit is contained in:
Marius Storm-Olsen 2009-02-21 15:48:43 +01:00 committed by Junio C Hamano
parent 5c9cc64a4a
commit f50edca56c

View File

@ -135,11 +135,17 @@ __git_ps1 ()
fi
fi
local c
if [ "true" = "$(git config --bool core.bare 2>/dev/null)" ]; then
c="BARE:"
fi
if [ -n "$b" ]; then
if [ -n "${1-}" ]; then
printf "$1" "${b##refs/heads/}$w$i$r"
printf "$1" "$c${b##refs/heads/}$w$i$r"
else
printf " (%s)" "${b##refs/heads/}$w$i$r"
printf " (%s)" "$c${b##refs/heads/}$w$i$r"
fi
fi
fi