fix git in a directory containing spaces

This commit is contained in:
Christophe Drevet 2012-11-05 10:53:23 +01:00
parent 452ef223ce
commit 337c473f6a

View File

@ -579,7 +579,8 @@ _lp_git_branch()
[[ "$LP_ENABLE_GIT" != 1 ]] && return [[ "$LP_ENABLE_GIT" != 1 ]] && return
topdir="$(git rev-parse --git-dir 2>/dev/null)" 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;')" echo -n "$(git branch 2>/dev/null | sed -n '/^\*/s/^\* //p;')"
fi fi
} }