Re: [PATCH] Add bare repository indicator for __git_ps1

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Marius Storm-Olsen <marius@xxxxxxxxxxxxxxx> writes:

> Junio, unfortunately you applied the incorrect version.
>
> It was v3 (Message-Id:
> <1235244057-16912-1-git-send-email-git@xxxxxxxxxxxxxxx>) 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 <git@xxxxxxxxxxxxxxx>
Acked-by: Shawn O. Pearce <spearce@xxxxxxxxxxx>
Signed-off-by: Junio C Hamano <gitster@xxxxxxxxx>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux