X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=git-parse-remote.sh;h=c9b899e3d73152a92523ed460f4d90fdab3d6f33;hb=7f732c632ff7a1adc2309257becdc0c1fe76b514;hp=5f158c613f333026ed42eac1c059b01500ba5e53;hpb=90768daaa006516c7ae69ed89d7c2e67243dfac1;p=git.git diff --git a/git-parse-remote.sh b/git-parse-remote.sh index 5f158c61..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,27 +77,27 @@ 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/*) ;; - heads/* | tags/* ) remote="refs/$remote" ;; + refs/heads/* | refs/tags/* | refs/remotes/*) ;; + heads/* | tags/* | remotes/* ) remote="refs/$remote" ;; *) remote="refs/heads/$remote" ;; esac case "$local" in '') local= ;; - refs/heads/* | refs/tags/*) ;; - heads/* | tags/* ) local="refs/$local" ;; + refs/heads/* | refs/tags/* | refs/remotes/*) ;; + heads/* | tags/* | remotes/* ) local="refs/$local" ;; *) 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