From: Marius Storm-Olsen Date: Sat, 21 Feb 2009 14:48:43 +0000 (+0100) Subject: Fixup: Add bare repository indicator for __git_ps1 X-Git-Tag: v1.6.3-rc0~214^2 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=ddb6d010231432ba75cf109aa7cd282912c88d2d;p=git.git Fixup: Add bare repository indicator for __git_ps1 Signed-off-by: Marius Storm-Olsen Acked-by: Shawn O. Pearce Signed-off-by: Junio C Hamano --- diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index a61d852a1..dd393cd00 100755 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -117,9 +117,14 @@ __git_ps1 () local w local i + local c if [ "true" = "$(git rev-parse --is-inside-git-dir 2>/dev/null)" ]; then - b="GIT_DIR!" + if [ "true" = "$(git config --bool core.bare 2>/dev/null)" ]; then + c="BARE:" + else + b="GIT_DIR!" + fi elif [ "true" = "$(git rev-parse --is-inside-work-tree 2>/dev/null)" ]; then if [ -n "${GIT_PS1_SHOWDIRTYSTATE-}" ]; then if [ "$(git config --bool bash.showDirtyState)" != "false" ]; then @@ -135,12 +140,6 @@ __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" "$c${b##refs/heads/}$w$i$r"