Browse Source

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

13
contrib/completion/git-completion.bash

@ -117,9 +117,14 @@ __git_ps1 () @@ -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
@ -135,12 +140,6 @@ __git_ps1 () @@ -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"

Loading…
Cancel
Save