From 337c473f6a9e4d15e4885a0e380330acdf783852 Mon Sep 17 00:00:00 2001 From: Christophe Drevet Date: Mon, 5 Nov 2012 10:53:23 +0100 Subject: [PATCH] fix git in a directory containing spaces --- liquidprompt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/liquidprompt b/liquidprompt index 14632d5..dc5769f 100755 --- a/liquidprompt +++ b/liquidprompt @@ -579,7 +579,8 @@ _lp_git_branch() [[ "$LP_ENABLE_GIT" != 1 ]] && return topdir="$(git rev-parse --git-dir 2>/dev/null)" - if [[ -n "$topdir" ]] && [[ "$(basename $topdir)" == '.git' ]] && [[ ! -z "$(git branch)" ]] ; then + topdirname=$(basename "$topdir") + if [[ -n "$topdir" ]] && [[ "$topdirname" == '.git' ]] && [[ ! -z "$(git branch)" ]] ; then echo -n "$(git branch 2>/dev/null | sed -n '/^\*/s/^\* //p;')" fi }