From: Junio C Hamano Date: Wed, 25 Feb 2009 06:08:50 GMT Subject: Re: [PATCH] Add bare repository indicator for __git_ps1 Message-ID: <7vk57fdp59.fsf@gitster.siamese.dyndns.org> In-Reply-To: <49A44EC6.3070800@storm-olsen.com> Marius Storm-Olsen writes: > Junio, unfortunately you applied the incorrect version. > > It was v3 (Message-Id: > <1235244057-16912-1-git-send-email-git@storm-olsen.com>) which was the > correct one, since it's the one that avoids the "GIT_DIR!" in a bare > repo. :-/ Sorry, I only was looking at the thread that had Shawn's Ack. Is this interdiff as a fix-up Ok? -- >8 -- Subject: [PATCH] Fixup: Add bare repository indicator for __git_ps1 Signed-off-by: Marius Storm-Olsen Acked-by: Shawn O. Pearce Signed-off-by: Junio C Hamano --- contrib/completion/git-completion.bash | 13 ++++++------- 1 files changed, 6 insertions(+), 7 deletions(-) diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index a61d852..dd393cd 100755 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -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 () 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" -- 1.6.2.rc1.113.ga620b