Subject: Re: [PATCH 12/16] builtin/repack.c: convert `--write-midx` to an `OPT_CALLBACK`

From: Jeff King <[email-masked]>
Date: Tue, 7 Apr 2026 02:18:37 -0400

On Sun, Mar 29, 2026 at 05:41:21PM -0400, Taylor Blau wrote:

> diff --git a/repack.h b/repack.h
> index 77d24ee45fb..81907fcce7f 100644
> --- a/repack.h
> +++ b/repack.h
> @@ -134,6 +134,11 @@ void pack_geometry_release(struct pack_geometry *geometry);
>  
>  struct tempfile;
>  
> +enum repack_write_midx_mode {
> +	REPACK_WRITE_MIDX_NONE,
> +	REPACK_WRITE_MIDX_DEFAULT,
> +};

Since the name of the variable did not change, the compiler would not
catch any old cases that did:

  if (write_midx)

for us. Which made me wonder if we should set _NONE to 0 explicitly here
so that continues to work, in case we missed a spot.

But after manually checking each spot that uses the enum (and there are
not that many), they have all been faithfully converted. So it's
probably not worth trying to preserve that compatibility (and anyway,
once we introduce a third mode, it's not clear that such a site would be
correct anymore anyway).

-Peff