[PATCH] Add bare repository indicator for __git_ps1
- From
- Marius Storm-Olsen <git@storm-olsen.com>
- Date
- Feb 21, 2009, 14:48 UTC
- Message-ID
- <1235227723-11471-1-git-send-email-git@storm-olsen.com>
Prefixes the branch name with "BARE:" if you're in a bare repository.
Signed-off-by: Marius Storm-Olsen <git@storm-olsen.com> --- Ok, had some free cycles, so here's fixed up version. Based on next this time
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 ec587d2..e585d40 100755 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -135,11 +135,17 @@ __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" "${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 fi
-- 1.6.2.rc1.20.g8c5b