mbox series

[00/11] midx: split MIDX writing routines into midx-write.c, cleanup

Message ID cover.1711387439.git.me@ttaylorr.com (mailing list archive)
Headers show
Series midx: split MIDX writing routines into midx-write.c, cleanup | expand

Message

Taylor Blau March 25, 2024, 5:24 p.m. UTC
This is a small-ish series that I worked on to split the functions from
midx.c which are responsible for writing MIDX files into a separate
compilation unit, midx-write.c.

This is done for a couple of reasons:

  - It reduces the size of midx.c, which is already quite large, thus
    making it easier to read.

  - It more clearly separates responsibility between the two, similar to
    the division between pack-bitmap.c, and pack-bitmap-write.c.

Most importantly, it makes midx.c easier to read in preparation for
future changes that I hope to make to midx.c in order to support
incremental MIDXs in a repository.

The series is structured as follows:

  - The first seven patches move all writing-related functions from
    midx.c to their new home in midx-write.c.

  - The remaining four patches rewrite `git multi-pack-index repack` in
    terms of `git pack-objects --stdin-packs`, yielding more
    tightly-packed output as a result of the supplemental traversal
    performed by `--stdin-packs`.

The first seven are the main goal of this series, and the remaining four
could be queued separately, depending on how folks feel about them.

Thanks in advance for your review!

Taylor Blau (11):
  midx-write: initial commit
  midx: extern a pair of shared functions
  midx: move `midx_repack` (and related functions) to midx-write.c
  midx: move `expire_midx_packs` to midx-write.c
  midx: move `write_midx_file_only` to midx-write.c
  midx: move `write_midx_file` to midx-write.c
  midx: move `write_midx_internal` (and related functions) to
    midx-write.c
  midx-write.c: avoid directly managed temporary strbuf
  midx-write.c: factor out common want_included_pack() routine
  midx-write.c: check count of packs to repack after grouping
  midx-write.c: use `--stdin-packs` when repacking

 Makefile     |    1 +
 midx-write.c | 1525 ++++++++++++++++++++++++++++++++++++++++++++++++
 midx.c       | 1558 +-------------------------------------------------
 midx.h       |   19 +
 4 files changed, 1559 insertions(+), 1544 deletions(-)
 create mode 100644 midx-write.c


base-commit: 3bd955d26919e149552f34aacf8a4e6368c26cec

Comments

Jeff King March 27, 2024, 8:39 a.m. UTC | #1
On Mon, Mar 25, 2024 at 01:24:11PM -0400, Taylor Blau wrote:

> This is a small-ish series that I worked on to split the functions from
> midx.c which are responsible for writing MIDX files into a separate
> compilation unit, midx-write.c.
> 
> This is done for a couple of reasons:
> 
>   - It reduces the size of midx.c, which is already quite large, thus
>     making it easier to read.
> 
>   - It more clearly separates responsibility between the two, similar to
>     the division between pack-bitmap.c, and pack-bitmap-write.c.

Yeah, I think this is a good cleanup. Like Junio, I did wonder about the
piece-meal movement. I kind of wonder if one big patch moving everything
would have been just as easy to review. But I'm happy either way.

The other refactoring patches all looked good to me.

-Peff