From c98f16d52f9cc22723679124c3d64b06cbcb6e6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olivier=20Mengu=C3=A9?= Date: Sat, 28 Jun 2014 22:27:32 +0200 Subject: [PATCH] Subversion: fix branch/tag extraction That was broken for a long long long... time. Should close #117, #237 and is an alternative to patch proposed by @anthonygelibert in #264. --- liquidprompt | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/liquidprompt b/liquidprompt index 15afcfc..0ae0d27 100755 --- a/liquidprompt +++ b/liquidprompt @@ -917,12 +917,14 @@ _lp_svn_branch() url="${url:${#root}}" if [[ "$url" == */trunk* ]] ; then echo -n trunk - elif [[ "$url" == */branches* ]] ; then - _lp_escape "$(expr "$url" : '.*/branches/\([^/]*\)' || expr "$url" : '/\([^/]*\)' || basename "$root")" - elif [[ "$url" == */tags* ]] ; then - _lp_escape "$(expr "$url" : '.*/tags/\([^/]*\)' || expr "$url" : '/\([^/]*\)' || basename "$root")" + elif [[ "$url" == */branches/?* ]] ; then + url="${url##*/branches/}" + _lp_escape "${url%/*}" + elif [[ "$url" == */tags/?* ]] ; then + url="${url##*/tags/}" + _lp_escape "${url%/*}" else - _lp_escape "$(basename "$root")" + _lp_escape "${root##*/}" fi }