aboutsummaryrefslogtreecommitdiff
path: root/contrib/completion/git-completion.bash
diff options
context:
space:
mode:
authorMarius Storm-Olsen <git@storm-olsen.com>2009-02-21 15:48:43 +0100
committerJunio C Hamano <gitster@pobox.com>2009-02-23 15:23:39 -0800
commitf50edca56c40cbfe48734eacd5d79416ba3649eb (patch)
treeb19ad8acf5e7dcec749fcb9afb90a8068f7e1384 /contrib/completion/git-completion.bash
parent5c9cc64a4a608ab0bbd5eb5c8e405bfe050be309 (diff)
downloadgit-f50edca56c40cbfe48734eacd5d79416ba3649eb.tar.gz
git-f50edca56c40cbfe48734eacd5d79416ba3649eb.tar.xz
Add bare repository indicator for __git_ps1
Prefixes the branch name with "BARE:" if you're in a bare repository. Signed-off-by: Marius Storm-Olsen <git@storm-olsen.com> Acked-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'contrib/completion/git-completion.bash')
-rwxr-xr-xcontrib/completion/git-completion.bash10
1 files changed, 8 insertions, 2 deletions
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 6e8c5b91a..a61d852a1 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