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.
This commit is contained in:
Olivier Mengué 2014-06-28 22:27:32 +02:00
parent 89a71c1c7d
commit c98f16d52f

View File

@ -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
}