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

efficient cloning

From
James Cloos <cloos@jhcloos.com>
Date
Mar 19, 2006, 21:16 UTC
Message-ID
<m3r74ykue7.fsf@lugabout.cloos.reno.nv.us>

Is there a way to accomplish the effect of this script w/o having to download any unnecessary objects?

================================================== #!/bin/bash

lt="/gits/linux-2.6/.git"
if [ $# -ne 2 ]; then
    echo >&2 "Usage: $0 <repo> <target-dir>"
    exit 1
fi
git-clone $1 $2
mkdir -p $2/objects/info
{
 test -f "$lt/objects/info/alternates" &&
 cat "$lt/objects/info/alternates";
 echo "$lt/objects"
} >"$2/objects/info/alternates"

cd $2 git-repack -a -d -s git-prune-packed ==================================================

I tried to modify git-clone to add an alternates file before calling fetch, but that file just gets deleted.

I presume I need to clone -s -l the local alternate, re-parent it to the new URL and grab anything missing, but how can I assure that it results in exactly the same repo as this script?

I'm often behind tiny straws, so efficiency is important.
-JimC
-- 
James H. Cloos, Jr. <cloos@jhcloos.com>
Next: Shawn Pearce
Message 1 of 22 in “efficient cloning”
  1. James CloosMar 19, 2006
  2. Shawn PearceMar 19, 2006
  3. Junio C HamanoMar 19, 2006
  4. James CloosMar 20, 2006
  5. Junio C HamanoMar 20, 2006
  6. Junio C HamanoMar 20, 2006
  7. Petr BaudisMar 20, 2006
  8. Junio C HamanoMar 20, 2006
  9. Petr BaudisMar 20, 2006
  10. Junio C HamanoMar 20, 2006
  11. Josef WeidendorferMar 20, 2006
  12. Junio C HamanoMar 20, 2006
  13. Petr BaudisMar 20, 2006
  14. Junio C HamanoMar 20, 2006
  15. Andreas EricssonMar 21, 2006
  16. Junio C HamanoMar 21, 2006
  17. Jeff KingMar 21, 2006
  18. Junio C HamanoMar 21, 2006
  19. Petr BaudisMar 21, 2006
  20. Josef WeidendorferMar 21, 2006
  21. Junio C HamanoMar 21, 2006
  22. Junio C HamanoMar 21, 2006

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.