X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=git-parse-remote.sh;h=c9b899e3d73152a92523ed460f4d90fdab3d6f33;hb=97d4df0b29d262df291985aed486e226b43132d0;hp=63f22818e6aa36b5f101af996941b0471ce3cbf3;hpb=cf1e6d1ec55264272be8b7f0c276a069d2aac69a;p=git.git diff --git a/git-parse-remote.sh b/git-parse-remote.sh index 63f22818..c9b899e3 100755 --- a/git-parse-remote.sh +++ b/git-parse-remote.sh @@ -8,8 +8,8 @@ get_data_source () { case "$1" in */*) # Not so fast. This could be the partial URL shorthand... - token=$(expr "$1" : '\([^/]*\)/') - remainder=$(expr "$1" : '[^/]*/\(.*\)') + token=$(expr "z$1" : 'z\([^/]*\)/') + remainder=$(expr "z$1" : 'z[^/]*/\(.*\)') if test -f "$GIT_DIR/branches/$token" then echo branches-partial @@ -43,8 +43,8 @@ get_remote_url () { branches) sed -e 's/#.*//' "$GIT_DIR/branches/$1" ;; branches-partial) - token=$(expr "$1" : '\([^/]*\)/') - remainder=$(expr "$1" : '[^/]*/\(.*\)') + token=$(expr "z$1" : 'z\([^/]*\)/') + remainder=$(expr "z$1" : 'z[^/]*/\(.*\)') url=$(sed -e 's/#.*//' "$GIT_DIR/branches/$token") echo "$url/$remainder" ;; @@ -77,13 +77,13 @@ canon_refs_list_for_fetch () { force= case "$ref" in +*) - ref=$(expr "$ref" : '\+\(.*\)') + ref=$(expr "z$ref" : 'z+\(.*\)') force=+ ;; esac - expr "$ref" : '.*:' >/dev/null || ref="${ref}:" - remote=$(expr "$ref" : '\([^:]*\):') - local=$(expr "$ref" : '[^:]*:\(.*\)') + expr "z$ref" : 'z.*:' >/dev/null || ref="${ref}:" + remote=$(expr "z$ref" : 'z\([^:]*\):') + local=$(expr "z$ref" : 'z[^:]*:\(.*\)') case "$remote" in '') remote=HEAD ;; refs/heads/* | refs/tags/* | refs/remotes/*) ;; @@ -97,7 +97,7 @@ canon_refs_list_for_fetch () { *) local="refs/heads/$local" ;; esac - if local_ref_name=$(expr "$local" : 'refs/\(.*\)') + if local_ref_name=$(expr "z$local" : 'zrefs/\(.*\)') then git-check-ref-format "$local_ref_name" || die "* refusing to create funny ref '$local_ref_name' locally" @@ -171,7 +171,7 @@ get_remote_refs_for_fetch () { resolve_alternates () { # original URL (xxx.git) - top_=`expr "$1" : '\([^:]*:/*[^/]*\)/'` + top_=`expr "z$1" : 'z\([^:]*:/*[^/]*\)/'` while read path do case "$path" in