3 # Copyright (c) 2005, Junio C Hamano
5 # Called by git-clone-script
6 # Exits 2 when the remote site does not support dumb server protocol.
8 # Usage: git-clone-dumb-http <remote-repo> <local-dir>
10 R=${1?"remote repository"} D=${2?"local directory"}
12 if [ -n "$GIT_SSL_NO_VERIFY" ]; then
16 # $1 = Remote, $2 = Local
17 curl -nsf $curl_extra_args "$1" >"$2"
21 clone_tmp=".git/clone-tmp" &&
22 mkdir -p "$clone_tmp" || exit 1
23 trap "rm -rf .git/clone-tmp" 0 1 2 3 15
25 http_fetch "$R/info/refs" "$clone_tmp/refs" &&
26 http_fetch "$R/objects/info/packs" "$clone_tmp/packs" || exit 2
28 # We do not have to worry about rev-cache when cloning.
29 # http_fetch "$R/info/rev-cache" "$clone_tmp/rev-cache"
39 idx=`expr "$name" : '\(.*\)\.pack'`.idx
40 http_fetch "$R/objects/pack/$name" ".git/objects/pack/$name" &&
41 http_fetch "$R/objects/pack/$idx" ".git/objects/pack/$idx" &&
42 git-verify-pack ".git/objects/pack/$idx" || exit 1
44 done <"$clone_tmp/packs"
47 while read sha1 refname
49 name=`expr "$refname" : 'refs/\(.*\)'` &&
50 git-http-pull -v -a -w "$name" "$name" "$R/" || exit 1
51 done <"$clone_tmp/refs"