@matheusbsbs / matheus-bagliano / commits / ddb6d01023
Fork 0

Fixup: Add bare repository indicator for __git_ps1

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>

Marius Storm-Olsen committed Feb 21, 2009 at 15:48 UTC ddb6d010231432ba75cf109aa7cd282912c88d2d
1 file changed +6 -7
contrib/completion/git-completion.bash
+6 -7
@@ -117,9 +117,14 @@ __git_ps1 ()
117
118 local w
119 local i
120 + local c
121
122 if [ "true" = "$(git rev-parse --is-inside-git-dir 2>/dev/null)" ]; then
122 - b="GIT_DIR!"
123 + if [ "true" = "$(git config --bool core.bare 2>/dev/null)" ]; then
124 + c="BARE:"
125 + else
126 + b="GIT_DIR!"
127 + fi
128 elif [ "true" = "$(git rev-parse --is-inside-work-tree 2>/dev/null)" ]; then
129 if [ -n "${GIT_PS1_SHOWDIRTYSTATE-}" ]; then
130 if [ "$(git config --bool bash.showDirtyState)" != "false" ]; then
@@ -135,12 +140,6 @@ __git_ps1 ()
140 fi
141 fi
142
138 - local c
139 -
140 - if [ "true" = "$(git config --bool core.bare 2>/dev/null)" ]; then
141 - c="BARE:"
142 - fi
143 -
143 if [ -n "$b" ]; then
144 if [ -n "${1-}" ]; then
145 printf "$1" "$c${b##refs/heads/}$w$i$r"