Re: [PATCH] Add bare repository indicator for __git_ps1

Subsystems: the rest

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

Re: [PATCH] Add bare repository indicator for __git_ps1

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:46:17

Marius Storm-Olsen [off-list ref] writes:
Junio, unfortunately you applied the incorrect version.

It was v3 (Message-Id:
[off-list ref]) 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 <redacted>
Acked-by: Shawn O. Pearce <redacted>
Signed-off-by: Junio C Hamano <redacted>
---
 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

Re: [PATCH] Add bare repository indicator for __git_ps1

From: Marius Storm-Olsen <hidden>
Date: 2016-06-15 22:46:17

Junio C Hamano said the following on 25.02.2009 07:08:
Marius Storm-Olsen [off-list ref] writes:
quoted
Junio, unfortunately you applied the incorrect version.

It was v3 (Message-Id:
[off-list ref]) 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?
Yup, looks sane to me. Thanks.

--
.marius
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help