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

[PATCH 0/4] Teach "git clone" to pack refs

From
Johan Herland <johan@herland.net>
Date
Jun 15, 2008, 14:02 UTC
Message-ID
<200806151602.03445.johan@herland.net>
(This is meant for AFTER v1.5.6.)

This is a re-post of the series I posted while builtin-clone was still under development. The rationale for this series can be found in earlier threads, but it roughly boils down to the following:

1. "git clone" currently creates "loose" refs for every ref in the cloned
   repo. A subsequent "git gc" will pack these refs into a packed-refs file.
   Having "git clone" produce the "packed" refs in the first place seems
   more efficient.
2. For repos with few refs the performance difference between writing loose
   refs and packed refs is negligible. However, for repos with thousands of
   refs [1], the difference between writing one packed-refs file and
   thousands of "loose" refs files is definitely noticeable. Even more so
   on Windows.
3. When the user updates a ref, a "loose" ref is written, and the
   corresponding packed ref (if any) is left unused. By making "git clone"
   write packed refs, we increase the overhead of unused packed refs
   (proportionally to the number of refs updated by the user). However,
   the number of refs updated by the user is typically small. If the user
   updates tens - or even hundreds - of refs, I still expect this overhead
   to be negligible, and in any case outweighed by the added performance
   when cloning repos with many refs.
The series is based on current 'next'.
Johan Herland (4):
  Incorporate fetched packs in future object traversal
  Move pack_refs() and friends into libgit
  Prepare testsuite for a "git clone" that packs refs
  Teach "git clone" to pack refs
 Makefile                     |    2 +
 builtin-clone.c              |    8 ++-
 builtin-fetch-pack.c         |    1 +
 builtin-pack-refs.c          |  121 +-----------------------------------------
 pack-refs.c                  |  117 ++++++++++++++++++++++++++++++++++++++++
 pack-refs.h                  |   18 ++++++
 t/t5515-fetch-merge-logic.sh |   19 +++++++
 7 files changed, 164 insertions(+), 122 deletions(-)
 create mode 100644 pack-refs.c
 create mode 100644 pack-refs.h
Have fun! :)
...Johan
[1]: At $dayjob I'm converting old CVS modules with up to ~10 years of
     history, and some of the resulting repos have ~30000 refs (mostly
     build tags). When cloning these repos, the speedup of this series
     can be measured in seconds on Linux; minutes on Windows.
Next: Johan Herland
Message 1 of 13 in “Teach "git clone" to pack refs”
  1. 0/4 Teach "git clone" to pack refsJohan Herland, Jun 15, 2008
  2. 1/4 Incorporate fetched packs in future object traversalJohan Herland, Jun 15, 2008
  3. 2/4 Move pack_refs() and friends into libgitJohan Herland, Jun 15, 2008
  4. Jeff KingJun 15, 2008
  5. 2/4 Move pack_refs() and friends into libgitJohan Herland, Jun 15, 2008
  6. 3/4 Prepare testsuite for a "git clone" that packs refsJohan Herland, Jun 15, 2008
  7. Jeff KingJun 15, 2008
  8. Jakub NarebskiJun 15, 2008
  9. 3/4 Prepare testsuite for a "git clone" that packs refsJohan Herland, Jun 15, 2008
  10. 4/4 Teach "git clone" to pack refsJohan Herland, Jun 15, 2008
  11. Jeff KingJun 15, 2008
  12. Johan HerlandJun 15, 2008
  13. Jeff KingJun 16, 2008

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.