gc.sh: always generate optimized packs
commit03111eecdc29d073a1316c324b8ed47081c65131
authorKyle J. McKay <mackyle@gmail.com>
Sat, 8 Oct 2016 07:08:14 +0000 (8 00:08 -0700)
committerKyle J. McKay <mackyle@gmail.com>
Sat, 8 Oct 2016 07:08:14 +0000 (8 00:08 -0700)
tree8537e9ab535d0451737536d9a5d9e54966803e36
parent22f2a7f092e121689c60a666c3993da5d77b427a
gc.sh: always generate optimized packs

Since Git version 1.7.7, git pack-objects generates much more optimized
packs, but ONLY if at least one of the commits being packed is the
target of a ref in the refs/tags/* namespace (any kind of tag, doesn't
matter).

While these optimized packs are very slightly smaller, the big win
involves disk accesses which can be significantly faster using these
better optimized packs.  (For example, git fsck can run in less than
half the time with such a pack!)

Therefore force git repack to always run in the presence of refs/tags/*
ref (a lightweight tag is used) that refers to one of the commits being
packed so that optimized packs are always produced.

This guarantees that very large repositories without any tags produce
optimized packs when they are repacked.

The strategy used is to create a temporary subdirectory with symbolic
links to the relevent items from the parent (config, info, objects,
refs) and a copy of HEAD and packed-refs where the extra ref has been
appended to the copy of packed-refs.  When git repack is run in the
subdirectory it packs the same things and puts the resulting packs in
the same place, but always produces optimized packs.

Signed-off-by: Kyle J. McKay <mackyle@gmail.com>
jobd/gc.sh