Browse Source

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>
maint
Marius Storm-Olsen 16 years ago committed by Junio C Hamano
parent
commit
f50edca56c
  1. 10
      contrib/completion/git-completion.bash

10
contrib/completion/git-completion.bash

@ -135,11 +135,17 @@ __git_ps1 () @@ -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

Loading…
Cancel
Save