From 8dd24cf18df1e063478139e4147e2c9f59b10e5e Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Thu, 5 Sep 2013 18:41:18 +0900 Subject: [PATCH] use git rev-parse to test if in git rep --- bashrc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bashrc b/bashrc index b1ac3bd..721c0ea 100755 --- a/bashrc +++ b/bashrc @@ -832,14 +832,14 @@ for f in /usr/share/git/git-prompt.sh \ /opt/local/share/git-core/git-prompt.sh \ /opt/local/share/doc/git-core/contrib/completion/git-prompt.sh do - test -r $f && . $f && break + test -r "$f" && . "$f" && break done GIT_PS1_SHOWDIRTYSTATE=t GIT_PS1_SHOWUPSTREAM=t __my_ps1_git(){ local last=$? null type __git_ps1 || return $last - null __gitdir || return $last + null git rev-parse --git-dir >/dev/null 2>&1 || return $last __git_ps1 "[GIT:$(__try_exec git config --get user.name):%s]" return $last }