From 56cef06883891424d147415d9a9982f4cedb1c8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olivier=20Mengu=C3=A9?= Date: Wed, 22 May 2013 23:42:55 +0200 Subject: [PATCH] Optimize _lp_svn_branch --- liquidprompt | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/liquidprompt b/liquidprompt index ba2b183..24e16e2 100755 --- a/liquidprompt +++ b/liquidprompt @@ -832,18 +832,15 @@ _lp_svn_branch() [[ "$LP_ENABLE_SVN" != 1 ]] && return local root local url - local result eval $(LANG=C LC_ALL=C svn info 2>/dev/null | sed -n 's/^URL: \(.*\)/url="\1"/p;s/^Repository Root: \(.*\)/root="\1"/p' ) - if [[ "$root" == "" ]]; then - return - fi + [[ -z "$root" ]] && return + # Make url relative to root url="${url:${#root}}" if [[ "$url" == */trunk* ]] ; then echo -n trunk else - result=$(expr "$url" : '.*/branches/\([^/]*\)' || expr "$url" : '/\([^/]*\)' || basename "$root") - echo -n $result # FIXME should be: echo -n $(_lp_escape "${result}") + _lp_escape "$(expr "$url" : '.*/branches/\([^/]*\)' || expr "$url" : '/\([^/]*\)' || basename "$root")" fi }