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

[RFC PATCH 00/10] repack: combine '--geometric' and '--cruft'

From
Taylor Blau <me@ttaylorr.com>
Date
Jun 26, 2026, 19:02 UTC
Message-ID
<cover.1782500507.git.me@ttaylorr.com>

First, a short note. This series is an RFC because I have not had the chance to review and test it as thoroughly as I normally would, and because we are deep in the -rc phase.

I wanted to get this series off my backlog since I have decided to leave GitHub at the end of the month for a new role. I will still be contributing to Git in my new role (which I will start in the early part of July), but wanted to get this off my backlog nonetheless.

This series teaches `git repack` how to combine `--geometric` and `--cruft`.

Today these two modes are mutually exclusive, since `--cruft` implies `-a`, and `-a` is fundamentally incompatible with `--geometric`. As a result, repositories have to choose between keeping reachable objects in a geometric progression of packs and collecting unreachable objects into cruft packs.

The goal of this series is to to be able to do both simultaneously. When both options are given, 'git repack' rolls up the selected non-cruft packs as usual while collecting unreachable objects separately into a cruft pack. That means a command like

    $ git repack -d --geometric=2 --cruft --combine-cruft-below-size=1G

will keep reachable non-cruft packs in a geometric progression, while combining sufficiently-small cruft packs (along with newly-discovered unreachable objects) into a fresh cruft pack.

The series is structured roughly as follows:
 * The first two patches prepare the cruft pack machinery for the later
   changes by making non-kept pack exclusion unconditional and
   extracting a helper for looking up packs in an `existing_packs` list.
 * The next four patches route geometric pack deletion through the
   common `existing_packs` machinery. They mark packs above the
   geometric split as retained, teach incremental-MIDX retention not to
   keep packs that are being rolled up, switch geometric repacks over to
   the common deletion path, and then remove the old geometry-specific
   deletion helper.
 * The next three patches teach `pack-objects` the new pieces needed by
   this mode. The main addition is `--stdin-packs=follow-reachable`,
   which walks from reference tips and includes only reachable objects
   from the selected packs, while still allowing traversal through
   excluded-open packs and stopping at excluded-closed ones. The
   following patch teaches that mode to use `--refs-snapshot`, so that
   `pack-objects` and the MIDX bitmap writer can agree on the same set
   of tips.
 * The final patch wires everything together in `git repack`, including
   teaching the cruft writer how to interpret the geometric split when
   choosing which packs to include or exclude.
Thanks in advance for your review!
Taylor Blau (10):
  repack: unconditionally exclude non-kept packs
  repack: extract `locate_existing_pack()` helper
  repack: mark geometric progression of packs as retained
  repack: teach MIDX retention about geometric rollups
  repack: delete geometric packs via existing_packs
  repack-geometry: drop unused redundant-pack removal
  pack-objects: extract `stdin_packs_add_all_pack_entries()`
  pack-objects: introduce '--stdin-packs=follow-reachable'
  pack-objects: support '--refs-snapshot' with 'follow-reachable'
  repack: support combining '--geometric' with '--cruft'
 Documentation/git-pack-objects.adoc |  25 +++
 Documentation/git-repack.adoc       |  11 ++
 builtin/pack-objects.c              | 276 ++++++++++++++++++++++++----
 builtin/repack.c                    |  38 ++--
 repack-cruft.c                      |  29 ++-
 repack-geometry.c                   |  44 -----
 repack.c                            | 101 +++++++++-
 repack.h                            |  15 +-
 t/t5331-pack-objects-stdin.sh       | 201 ++++++++++++++++++++
 t/t7704-repack-cruft.sh             | 251 +++++++++++++++++++++++++
 10 files changed, 878 insertions(+), 113 deletions(-)
base-commit: ab776a62a78576513ee121424adb19597fbb7613
-- 
2.55.0.rc2.10.g29e31820dce
Next: Taylor Blau
Message 1 of 18 in “repack: combine '--geometric' and '--cruft'”
  1. 00/10 repack: combine '--geometric' and '--cruft'Taylor Blau, Jun 26, 2026
  2. 01/10 repack: unconditionally exclude non-kept packsTaylor Blau, Jun 26, 2026
  3. 03/10 repack: mark geometric progression of packs as retainedTaylor Blau, Jun 26, 2026
  4. 04/10 repack: teach MIDX retention about geometric rollupsTaylor Blau, Jun 26, 2026
  5. Junio C HamanoJun 26, 2026
  6. Taylor BlauJun 27, 2026
  7. 05/10 repack: delete geometric packs via existing_packsTaylor Blau, Jun 26, 2026
  8. 06/10 repack-geometry: drop unused redundant-pack removalTaylor Blau, Jun 26, 2026
  9. 02/10 repack: extract `locate_existing_pack()` helperTaylor Blau, Jun 26, 2026
  10. 07/10 pack-objects: extract `stdin_packs_add_all_pack_entries()`Taylor Blau, Jun 26, 2026
  11. 08/10 pack-objects: introduce '--stdin-packs=follow-reachable'Taylor Blau, Jun 26, 2026
  12. Junio C HamanoJun 26, 2026
  13. Taylor BlauJun 27, 2026
  14. Junio C HamanoJun 27, 2026
  15. Taylor BlauJun 27, 2026
  16. 09/10 pack-objects: support '--refs-snapshot' with 'follow-reachable'Taylor Blau, Jun 26, 2026
  17. 10/10 repack: support combining '--geometric' with '--cruft'Taylor Blau, Jun 26, 2026
  18. Junio C HamanoJul 27, 2026

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.