Skip to content

Commit

Permalink
Add bare repository indicator for __git_ps1
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Marius Storm-Olsen authored and Junio C Hamano committed Feb 23, 2009
1 parent 5c9cc64 commit f50edca
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions contrib/completion/git-completion.bash
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f50edca

Please sign in to comment.