git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] Add bare repository indicator for __git_ps1

From
Marius Storm-Olsen <marius@trolltech.com>
Date
Feb 20, 2009, 14:56 UTC
Message-ID
<499EC48B.9070004@trolltech.com>

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

Signed-off-by: Marius Storm-Olsen <marius@trolltech.com>
---
 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
Next: Johannes Schindelin
Message 1 of 9 in “Add bare repository indicator for __git_ps1”
  1. Add bare repository indicator for __git_ps1Marius Storm-Olsen, Feb 20, 2009
  2. Johannes SchindelinFeb 20, 2009
  3. Thomas RastFeb 20, 2009
  4. Michael J GruberFeb 20, 2009
  5. Marius Storm-OlsenFeb 20, 2009
  6. Michael J GruberFeb 20, 2009
  7. Marius Storm-OlsenFeb 20, 2009
  8. Ted PavlicFeb 20, 2009
  9. Marius Storm-OlsenFeb 20, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.