Skip to content

Commit

Permalink
Fixup: Add bare repository indicator for __git_ps1
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Marius Storm-Olsen authored and Junio C Hamano committed Feb 25, 2009
1 parent f50edca commit ddb6d01
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions contrib/completion/git-completion.bash
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,14 @@ __git_ps1 ()

local w
local i
local c

if [ "true" = "$(git rev-parse --is-inside-git-dir 2>/dev/null)" ]; then
b="GIT_DIR!"
if [ "true" = "$(git config --bool core.bare 2>/dev/null)" ]; then
c="BARE:"
else
b="GIT_DIR!"
fi
elif [ "true" = "$(git rev-parse --is-inside-work-tree 2>/dev/null)" ]; then
if [ -n "${GIT_PS1_SHOWDIRTYSTATE-}" ]; then
if [ "$(git config --bool bash.showDirtyState)" != "false" ]; then
Expand All @@ -135,12 +140,6 @@ __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" "$c${b##refs/heads/}$w$i$r"
Expand Down

0 comments on commit ddb6d01

Please sign in to comment.