From f50edca56c40cbfe48734eacd5d79416ba3649eb Mon Sep 17 00:00:00 2001 From: Marius Storm-Olsen Date: Sat, 21 Feb 2009 15:48:43 +0100 Subject: [PATCH] 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 Acked-by: Shawn O. Pearce Signed-off-by: Junio C Hamano --- contrib/completion/git-completion.bash | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 6e8c5b91ac..a61d852a14 100755 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -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 -- 2.11.4.GIT