From: Junio C Hamano Date: Sat, 17 Sep 2005 08:50:37 GMT Subject: Help cloning over http. Message-ID: <7vvf10axia.fsf_-_@assigned-by-dhcp.cox.net> In-Reply-To: <7vacicccxl.fsf@assigned-by-dhcp.cox.net> Even when repository is packed, the new "we trust only the refs we already have" code wasted too much time verifying what are already in packs, walking down to the root commits. Since we slurp all the necessary packs upfront and run verify pack on them, temporarily register their edge commits as "known to be good" before invoking git-http-fetch. I am not proud of this workaround -- this would probably break in a pathological case where the remote repository has packs that depend on ancient unpacked objects, but people should not be making such packs anyway (git repack would not create such packs). Signed-off-by: Junio C Hamano --- git-clone.sh | 19 +++++++++++++++++++ 1 files changed, 19 insertions(+), 0 deletions(-) 34414e4170ab8d1d2a9ef582256530dc3b42d3e2 diff --git a/git-clone.sh b/git-clone.sh --- a/git-clone.sh +++ b/git-clone.sh @@ -50,11 +50,30 @@ Perhaps git-update-server-info needs to git-verify-pack ".git/objects/pack/$idx" || exit 1 done <"$clone_tmp/packs" + while read type idx sha1 commit + do + case "$type,$commit" in + T,commit) ;; + *) continue ;; + esac && + echo "$sha1" >.git/refs/tags/clone-tmp-$sha1 + done <"$clone_tmp/packs" + while read sha1 refname do name=`expr "$refname" : 'refs/\(.*\)'` && git-http-fetch -v -a -w "$name" "$name" "$1/" || exit 1 done <"$clone_tmp/refs" + + while read type idx sha1 commit + do + case "$type,$commit" in + T,commit) ;; + *) continue ;; + esac && + rm -f .git/refs/tags/clone-tmp-$sha1 + done <"$clone_tmp/packs" + rm -fr "$clone_tmp" }