[PATCH] Add bare repository indicator for __git_ps1

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

 



Prefixes the branch name with "BARE:" if you're in a
bare repository.

Signed-off-by: Marius Storm-Olsen <marius@xxxxxxxxxxxxx>
---
Patch tried sent via ThunderGit extension. Sorry if it's mangled :-)

contrib/completion/git-completion.bash |   10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 0a3092f..c741203 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -138,10 +138,16 @@ __git_ps1 ()
			fi
		fi

+		local c
+		
+		if test "$(git config --bool core.bare)" == "true"; then
+			c="BARE:"
+		fi
+
		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
}
--
1.6.2.rc1.20.g8c5b


--
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