Subject: Re: [PATCH] Add bare repository indicator for __git_ps1

From: Junio C Hamano <[email-masked]>
Date: Tue, 24 Feb 2009 22:08:50 -0800

Marius Storm-Olsen <[email-masked]> writes:

> Junio, unfortunately you applied the incorrect version.
>
> It was v3 (Message-Id:
> <[email-masked]>) which was the
> correct one, since it's the one that avoids the "GIT_DIR!" in a bare
> repo. :-/

Sorry, I only was looking at the thread that had Shawn's Ack.
Is this interdiff as a fix-up Ok?

-- >8 --

Subject: [PATCH] Fixup: Add bare repository indicator for __git_ps1

Signed-off-by: Marius Storm-Olsen <[email-masked]>
Acked-by: Shawn O. Pearce <[email-masked]>
Signed-off-by: Junio C Hamano <[email-masked]>
---
 contrib/completion/git-completion.bash |   13 ++++++-------
 1 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index a61d852..dd393cd 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"
-- 
1.6.2.rc1.113.ga620b