mbox series

[0/2] refs/files: use heuristic to decide whether to repack with `--auto`

Message ID cover.1725280479.git.ps@pks.im (mailing list archive)
Headers show
Series refs/files: use heuristic to decide whether to repack with `--auto` | expand

Message

Patrick Steinhardt Sept. 2, 2024, 1:48 p.m. UTC
Hi,

I recently noticed that `git maintenance run --auto` always ends up
repacking loose references. This is because the "files" backend does not
yet have any heuristics wired up to decide whether or not packing refs
is in order. The consequence is that we always decided to pack them,
which is of course quite a waste of time.

This small patch series fixes this by introducing a new heuristic for
the "files" backend. The heuristic is rather simple: the bigger the
"packed-refs" file, the more loose refs we require before we decide to
repack. We have been using this heurisitc successfully for a long time
in Gitaly by now.

Thanks!

Patrick

Patrick Steinhardt (2):
  t0601: merge tests for auto-packing of refs
  refs/files: use heuristic to decide whether to repack with `--auto`

 refs/files-backend.c          |  75 +++++++++++++++++++++++++
 refs/packed-backend.c         |  18 ++++++
 refs/packed-backend.h         |   7 +++
 t/t0601-reffiles-pack-refs.sh | 101 ++++++++++++++++++++++++++++------
 4 files changed, 185 insertions(+), 16 deletions(-)