git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Help cloning over http.

From
Junio C Hamano <junkio@cox.net>
Date
Sep 17, 2005, 08:50 UTC
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 <junkio@cox.net>
---
 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"
 }
 
Previous: Junio C HamanoNext: Daniel Barkalow
Message 9 of 11 in “Fix fetch completeness assumptions”
  1. Fix fetch completeness assumptionsDaniel Barkalow, Sep 15, 2005
  2. Junio C HamanoSep 15, 2005
  3. Daniel BarkalowSep 15, 2005
  4. Sergey VlasovSep 15, 2005
  5. Daniel BarkalowSep 15, 2005
  6. Junio C HamanoSep 16, 2005
  7. Junio C HamanoSep 17, 2005
  8. Junio C HamanoSep 17, 2005
  9. Help cloning over http.Junio C Hamano, Sep 17, 2005
  10. Daniel BarkalowSep 17, 2005
  11. Improve the safety check used in fetch.cJunio C Hamano, Sep 18, 2005

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.