X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=git-clone-script;h=60dc2a9d8854fd08c708d4a75f1c887d1d724b9f;hb=b8c20680c863379a7089091a4f1cd6ece20fd9e6;hp=88e2c1f70686d35e6f2d9070931e40ff3ae7e1a5;hpb=6ec311da34cbbc8a571bf889b6ef00c4efb441b5;p=git.git diff --git a/git-clone-script b/git-clone-script index 88e2c1f7..60dc2a9d 100755 --- a/git-clone-script +++ b/git-clone-script @@ -20,12 +20,12 @@ upload_pack= while case "$#,$1" in 0,*) break ;; - *,-l|*,--l|*,--lo|*,--loc|*,--loca|*,--local) use_local=yes ;; + *,-l|*,--l|*,--lo|*,--loc|*,--loca|*,--local) use_local=yes ;; *,-q|*,--quiet) quiet=-q ;; - 1,-u|*,--upload-pack) usage ;; + 1,-u|1,--upload-pack) usage ;; *,-u|*,--upload-pack) shift - upload_pack="--exec=$2" ;; + upload_pack="--exec=$1" ;; *,-*) usage ;; *) break ;; esac @@ -81,23 +81,37 @@ yes,yes) HEAD=HEAD fi tar Ccf "$repo" - refs $HEAD | tar Cxf "$D/.git" - || exit 1 - exit 0 - ;; -esac - -case "$repo" in -rsync://*) - rsync $quiet -avz --ignore-existing "$repo/objects/" "$D/.git/objects/" && - rsync $quiet -avz --ignore-existing "$repo/refs/" "$D/.git/refs/" - ;; -http://*) - echo "Somebody should add http fetch" >&2 - exit 1 ;; *) - cd "$D" && case "$upload_pack" in - '') git-clone-pack $quiet "$repo" ;; - *) git-clone-pack $quiet "$upload_pack" "$repo" ;; + case "$repo" in + rsync://*) + rsync $quiet -avz --ignore-existing "$repo/objects/" "$D/.git/objects/" && + rsync $quiet -avz --ignore-existing "$repo/refs/" "$D/.git/refs/" + ;; + http://*) + git-clone-dumb-http "$repo" "$D" + case "$?" in + 2) + echo "Somebody should define smarter http server protocol" >&2 + exit 1 + ;; + 0) + ;; + *) + exit + esac + ;; + *) + cd "$D" && case "$upload_pack" in + '') git-clone-pack $quiet "$repo" ;; + *) git-clone-pack $quiet "$upload_pack" "$repo" ;; + esac + ;; esac ;; esac + +# Update origin. +mkdir -p "$D/.git/branches/" && +rm -f "$D/.git/branches/origin" && +echo "$repo" >"$D/.git/branches/origin"