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

From: Johan Herland <[email-masked]>
Date: Sun, 15 Jun 2008 16:02:03 +0200

(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.