From 0c57f27bbacafca2e360c4045ebd1b3d830c7c0a Mon Sep 17 00:00:00 2001 From: Joseph Bass Date: Sat, 20 Apr 2013 20:59:46 -0600 Subject: [PATCH] Only show the branch specifier if the current directory is part of a git repo --- liquidprompt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/liquidprompt b/liquidprompt index 1ce6e72..adeb2c4 100755 --- a/liquidprompt +++ b/liquidprompt @@ -685,7 +685,7 @@ _lp_git_branch() { [[ "$LP_ENABLE_GIT" != 1 ]] && return local gitdir - gitdir="$(git rev-parse --git-dir 2>/dev/null)" + gitdir="$([ $(git ls-files . 2>/dev/null | wc -l) -gt 0 ] && git rev-parse --git-dir 2>/dev/null)" [[ $? -ne 0 || ! $gitdir =~ (.*\/)?\.git.* ]] && return local branch="$(git symbolic-ref HEAD 2>/dev/null)" if [[ $? -ne 0 || -z "$branch" ]] ; then