🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.git
Article #4218

[PATCH v2 0/5] builtin/multi-pack-index: remove global state

#4218
From: Justin Tobler
Date: Tue, 01 Dec 2026 18:16
523 lines
34517 bytes
Greetings,

This series cleans up git-multi-pack-index(1) by getting rid of
`the_repository` and the global state used to track its options. Each
subcommand now parses its options into a local structure, and the common
options are wired up via a macro instead of allocating a combined
options array for every subcommand.

The main reason the options are global is that "--object-dir=" and
"--[no-]progress" are also accepted before the subcommand, where the
top-level builtin parses them into the same global state used by the
subcommands. Patch 3 drops support for giving these options before the
subcommand, as every subcommand already accepts both of them.

The "--[no-]progress" option was previously removed as a top-level
option in 0394f8d002 (builtin/multi-pack-index.c: disable top-level
--[no-]progress, 2021-09-20) and appears to have been inadvertently
reintroduced via 6b8fb17490 (builtin/multi-pack-index.c: make
'--progress' a common option, 2026-02-24). So I think it should be fine
to drop.

While "--object-dir=" has never previously been dropped, it appears to
exist as a top-level option for the same historical reason, from when
all options were parsed by the top-level builtin. Since the subcommands
already parse the common options themselves, it should ideally be
dropped as well. If we want to keep this top-level option though, an
alternative could be to propagate the option argument to each
subcommand. In this case, I don't think it's worth it, but happy to
change if others feel differently.

This series is built on top of 86e79b2795 (The 26th batch, 2026-11-29).

Changes since V1:
  - "--object-dir=" is now parsed via `OPT_STRING()`, so the option
    value no longer needs to be allocated or freed.
  - Clarified in the message of patch 2 that the repository may still be
    `NULL` until `parse_options()` has been called.
  - The synopsis and usage strings now explicitly list the common
    options instead of using the `[<options>]` placeholder.
  - The common options are now added at the front of each options array,
    so the order of the "-h" output stays the same.

Thanks for the review,
-Justin

Justin Tobler (5):
  builtin/multi-pack-index: resolve default object directory lazily
  builtin/multi-pack-index: get rid of `the_repository`
  builtin/multi-pack-index: drop top-level options
  builtin/multi-pack-index: simplify how common options are wired up
  builtin/multi-pack-index: de-globalize options handling

 Documentation/git-multi-pack-index.adoc |  23 ++--
 builtin/multi-pack-index.c              | 165 +++++++++---------------
 t/lib-midx.sh                           |   2 +-
 t/t5319-multi-pack-index.sh             |  32 ++---
 4 files changed, 91 insertions(+), 131 deletions(-)

Range-diff against v1:
1:  c381afb0da59 ! 1:  3e6369b99ba3 builtin/multi-pack-index: resolve default object directory lazily
    @@ Commit message
         where the repository is passed in explicitly. This also removes the
         need for the defensive `NULL` checks guarding the eager initialization.
     
    +    With the default handled lazily, the callback for "--object-dir=" is
    +    only left to resolve the given path via `real_pathdup()`. This is
    +    unnecessary though, as `odb_source_files_find_dir()` already resolves
    +    the path itself when looking up the matching object directory. Replace
    +    the callback with a plain `OPT_STRING()`, which also means that the
    +    option value no longer has to be allocated and freed.
    +
         Signed-off-by: Justin Tobler <jltobler@gmail.com>
     
      ## builtin/multi-pack-index.c ##
    -@@ builtin/multi-pack-index.c: static int parse_object_dir(const struct option *opt, const char *arg,
    - 	char **value = opt->value;
    - 	free(*value);
    - 	if (unset)
    --		*value = xstrdup(the_repository->objects->source->path);
    -+		*value = NULL;
    - 	else
    - 		*value = real_pathdup(arg, 1);
    - 	return 0;
    -@@ builtin/multi-pack-index.c: static int parse_object_dir(const struct option *opt, const char *arg,
    +@@
    + #define USE_THE_REPOSITORY_VARIABLE
    + #include "builtin.h"
    +-#include "abspath.h"
    + #include "config.h"
    + #include "environment.h"
    + #include "gettext.h"
    +@@ builtin/multi-pack-index.c: static char const * const builtin_multi_pack_index_usage[] = {
    + };
    + 
    + static struct opts_multi_pack_index {
    +-	char *object_dir;
    ++	const char *object_dir;
    + 	const char *preferred_pack;
    + 	const char *incremental_base;
    + 	char *refs_snapshot;
    +@@ builtin/multi-pack-index.c: static struct opts_multi_pack_index {
    + 	int stdin_packs;
    + } opts;
      
    +-
    +-static int parse_object_dir(const struct option *opt, const char *arg,
    +-			    int unset)
    +-{
    +-	char **value = opt->value;
    +-	free(*value);
    +-	if (unset)
    +-		*value = xstrdup(the_repository->objects->source->path);
    +-	else
    +-		*value = real_pathdup(arg, 1);
    +-	return 0;
    +-}
    +-
      static struct odb_source_packed *handle_object_dir_option(struct repository *repo)
      {
     -	struct odb_files_dir *dir = odb_source_files_find_dir(repo->objects, opts.object_dir);
    @@ builtin/multi-pack-index.c: static int parse_object_dir(const struct option *opt
      	return dir->packed;
      }
      
    + static struct option common_opts[] = {
    +-	OPT_CALLBACK(0, "object-dir", &opts.object_dir,
    +-	  N_("directory"),
    +-	  N_("object directory containing set of packfile and pack-index pairs"),
    +-	  parse_object_dir),
    ++	OPT_STRING(0, "object-dir", &opts.object_dir, N_("directory"),
    ++	  N_("object directory containing set of packfile and pack-index pairs")),
    + 	OPT_BIT(0, "progress", &opts.flags, N_("force progress reporting"),
    + 		MIDX_PROGRESS),
    + 	OPT_END(),
     @@ builtin/multi-pack-index.c: int cmd_multi_pack_index(int argc,
      
      	repo_config(the_repository, git_default_config, NULL);
    @@ builtin/multi-pack-index.c: int cmd_multi_pack_index(int argc,
      	argc = parse_options(argc, argv, prefix, options,
      			     builtin_multi_pack_index_usage, 0);
      	FREE_AND_NULL(options);
    + 
    + 	res = fn(argc, argv, prefix, repo);
    + 
    +-	free(opts.object_dir);
    + 	return res;
    + }
2:  673945d65de3 ! 2:  28d7916f0a24 builtin/multi-pack-index: get rid of `the_repository`
    @@ Commit message
         builtin/multi-pack-index: get rid of `the_repository`
     
         There are a couple of remaining references to `the_repository` in
    -    git-multi-pack-index(1). The command cannot run outside of a repository,
    -    so these references can be trivially replaced with the repository
    -    passed to the subcommands.
    +    git-multi-pack-index(1). Replace them with the repository that is passed
    +    to the builtin and its subcommands.
    +
    +    Note that the repository may still be `NULL` until `parse_options()` has
    +    been called. The only use of the repository before that point is
    +    `repo_config()`, which handles a `NULL` repository.
     
         Signed-off-by: Justin Tobler <jltobler@gmail.com>
     
    @@ builtin/multi-pack-index.c
     @@
     -#define USE_THE_REPOSITORY_VARIABLE
      #include "builtin.h"
    - #include "abspath.h"
      #include "config.h"
    + #include "environment.h"
     @@ builtin/multi-pack-index.c: static int cmd_multi_pack_index_write(int argc, const char **argv,
      
      	opts.flags |= MIDX_WRITE_BITMAP_HASH_CACHE;
3:  cc2876d6803f ! 3:  5fe18c5564c3 builtin/multi-pack-index: drop top-level options
    @@ Documentation/git-multi-pack-index.adoc: git-multi-pack-index - Write and verify
      --------
      [verse]
     -'git multi-pack-index' [<options>] write [--preferred-pack=<pack>]
    -+'git multi-pack-index' write [<options>] [--preferred-pack=<pack>]
    - 		         [--[no-]bitmap] [--[no-]incremental] [--[no-]stdin-packs]
    - 		         [--refs-snapshot=<path>] [--[no-]write-chain-file]
    - 			 [--base=<checksum>]
    +-		         [--[no-]bitmap] [--[no-]incremental] [--[no-]stdin-packs]
    +-		         [--refs-snapshot=<path>] [--[no-]write-chain-file]
    +-			 [--base=<checksum>]
     -'git multi-pack-index' [<options>] compact [--[no-]incremental]
    -+'git multi-pack-index' compact [<options>] [--[no-]incremental]
    - 		         [--[no-]bitmap] [--base=<checksum>] [--[no-]write-chain-file]
    - 			 <from> <to>
    +-		         [--[no-]bitmap] [--base=<checksum>] [--[no-]write-chain-file]
    +-			 <from> <to>
     -'git multi-pack-index' [<options>] verify
     -'git multi-pack-index' [<options>] expire
     -'git multi-pack-index' [<options>] repack [--batch-size=<size>]
    -+'git multi-pack-index' verify [<options>]
    -+'git multi-pack-index' expire [<options>]
    -+'git multi-pack-index' repack [<options>] [--batch-size=<size>]
    ++'git multi-pack-index' write [--object-dir=<dir>] [--[no-]progress]
    ++		         [--preferred-pack=<pack>] [--[no-]bitmap] [--[no-]incremental]
    ++		         [--[no-]stdin-packs] [--refs-snapshot=<path>]
    ++		         [--[no-]write-chain-file] [--base=<checksum>]
    ++'git multi-pack-index' compact [--object-dir=<dir>] [--[no-]progress]
    ++		         [--[no-]incremental] [--[no-]bitmap] [--base=<checksum>]
    ++		         [--[no-]write-chain-file] <from> <to>
    ++'git multi-pack-index' verify [--object-dir=<dir>] [--[no-]progress]
    ++'git multi-pack-index' expire [--object-dir=<dir>] [--[no-]progress]
    ++'git multi-pack-index' repack [--object-dir=<dir>] [--[no-]progress]
    ++		         [--batch-size=<size>]
      
      DESCRIPTION
      -----------
    @@ builtin/multi-pack-index.c
      
      #define BUILTIN_MIDX_WRITE_USAGE \
     -	N_("git multi-pack-index [<options>] write [--preferred-pack=<pack>]\n" \
    -+	N_("git multi-pack-index write [<options>] [--preferred-pack=<pack>]\n" \
    - 	   "  [--[no-]bitmap] [--[no-]incremental] [--[no-]stdin-packs]\n" \
    - 	   "  [--refs-snapshot=<path>] [--[no-]write-chain-file]\n" \
    - 	   "  [--base=<checksum>]")
    +-	   "  [--[no-]bitmap] [--[no-]incremental] [--[no-]stdin-packs]\n" \
    +-	   "  [--refs-snapshot=<path>] [--[no-]write-chain-file]\n" \
    +-	   "  [--base=<checksum>]")
    ++	N_("git multi-pack-index write [--object-dir=<dir>] [--[no-]progress]\n" \
    ++	   "  [--preferred-pack=<pack>] [--[no-]bitmap] [--[no-]incremental]\n" \
    ++	   "  [--[no-]stdin-packs] [--refs-snapshot=<path>]\n" \
    ++	   "  [--[no-]write-chain-file] [--base=<checksum>]")
      
      #define BUILTIN_MIDX_COMPACT_USAGE \
     -	N_("git multi-pack-index [<options>] compact [--[no-]incremental]\n" \
    -+	N_("git multi-pack-index compact [<options>] [--[no-]incremental]\n" \
    - 	   "  [--[no-]bitmap] [--base=<checksum>] [--[no-]write-chain-file]\n" \
    - 	   "  <from> <to>")
    +-	   "  [--[no-]bitmap] [--base=<checksum>] [--[no-]write-chain-file]\n" \
    +-	   "  <from> <to>")
    ++	N_("git multi-pack-index compact [--object-dir=<dir>] [--[no-]progress]\n" \
    ++	   "  [--[no-]incremental] [--[no-]bitmap] [--base=<checksum>]\n" \
    ++	   "  [--[no-]write-chain-file] <from> <to>")
      
      #define BUILTIN_MIDX_VERIFY_USAGE \
     -	N_("git multi-pack-index [<options>] verify")
    -+	N_("git multi-pack-index verify [<options>]")
    ++	N_("git multi-pack-index verify [--object-dir=<dir>] [--[no-]progress]")
      
      #define BUILTIN_MIDX_EXPIRE_USAGE \
     -	N_("git multi-pack-index [<options>] expire")
    -+	N_("git multi-pack-index expire [<options>]")
    ++	N_("git multi-pack-index expire [--object-dir=<dir>] [--[no-]progress]")
      
      #define BUILTIN_MIDX_REPACK_USAGE \
     -	N_("git multi-pack-index [<options>] repack [--batch-size=<size>]")
    -+	N_("git multi-pack-index repack [<options>] [--batch-size=<size>]")
    ++	N_("git multi-pack-index repack [--object-dir=<dir>] [--[no-]progress]\n" \
    ++	   "  [--batch-size=<size>]")
      
      static char const * const builtin_multi_pack_index_write_usage[] = {
      	BUILTIN_MIDX_WRITE_USAGE,
4:  1c16a0988239 ! 4:  3bb2b9a69f1c builtin/multi-pack-index: simplify how common options are wired up
    @@ builtin/multi-pack-index.c: static struct odb_source_packed *handle_object_dir_o
      }
      
     -static struct option common_opts[] = {
    --	OPT_CALLBACK(0, "object-dir", &opts.object_dir,
    --	  N_("directory"),
    --	  N_("object directory containing set of packfile and pack-index pairs"),
    --	  parse_object_dir),
    +-	OPT_STRING(0, "object-dir", &opts.object_dir, N_("directory"),
    +-	  N_("object directory containing set of packfile and pack-index pairs")),
     -	OPT_BIT(0, "progress", &opts.flags, N_("force progress reporting"),
     -		MIDX_PROGRESS),
     -	OPT_END(),
    @@ builtin/multi-pack-index.c: static struct odb_source_packed *handle_object_dir_o
     -	return parse_options_concat(common_opts, prev);
     -}
     +#define MULTI_PACK_INDEX_COMMON_OPTIONS(opts) \
    -+	OPT_CALLBACK(0, "object-dir", &(opts)->object_dir, \
    -+	  N_("directory"), \
    -+	  N_("object directory containing set of packfile and pack-index pairs"), \
    -+	  parse_object_dir), \
    ++	OPT_STRING(0, "object-dir", &(opts)->object_dir, N_("directory"), \
    ++	  N_("object directory containing set of packfile and pack-index pairs")), \
     +	OPT_BIT(0, "progress", &(opts)->flags, N_("force progress reporting"), \
     +		MIDX_PROGRESS)
      
    @@ builtin/multi-pack-index.c: static int cmd_multi_pack_index_write(int argc, cons
     -	struct option *options;
     -	static struct option builtin_multi_pack_index_write_options[] = {
     +	static struct option options[] = {
    ++		MULTI_PACK_INDEX_COMMON_OPTIONS(&opts),
      		OPT_STRING(0, "preferred-pack", &opts.preferred_pack,
      			   N_("preferred-pack"),
      			   N_("pack for reuse when computing a multi-pack bitmap")),
     @@ builtin/multi-pack-index.c: static int cmd_multi_pack_index_write(int argc, const char **argv,
    - 			 N_("write multi-pack index containing only given indexes")),
    - 		OPT_FILENAME(0, "refs-snapshot", &opts.refs_snapshot,
    - 			     N_("refs snapshot for selecting bitmap commits")),
    -+		MULTI_PACK_INDEX_COMMON_OPTIONS(&opts),
    - 		OPT_END(),
    - 	};
    - 	struct odb_source_packed *packed_source;
    -@@ builtin/multi-pack-index.c: static int cmd_multi_pack_index_write(int argc, const char **argv,
      
      	repo_config(repo, git_multi_pack_index_write_config, NULL);
      
    @@ builtin/multi-pack-index.c: static int cmd_multi_pack_index_compact(int argc, co
     -	struct option *options;
     -	static struct option builtin_multi_pack_index_compact_options[] = {
     +	static struct option options[] = {
    ++		MULTI_PACK_INDEX_COMMON_OPTIONS(&opts),
      		OPT_STRING(0, "base", &opts.incremental_base, N_("checksum"),
      			   N_("base MIDX for incremental writes")),
      		OPT_BIT(0, "bitmap", &opts.flags, N_("write multi-pack bitmap"),
     @@ builtin/multi-pack-index.c: static int cmd_multi_pack_index_compact(int argc, const char **argv,
    - 		OPT_NEGBIT(0, "write-chain-file", &opts.flags,
    - 			N_("write the multi-pack-index chain file"),
    - 			MIDX_WRITE_NO_CHAIN),
    -+		MULTI_PACK_INDEX_COMMON_OPTIONS(&opts),
    - 		OPT_END(),
    - 	};
      
      	repo_config(repo, git_multi_pack_index_write_config, NULL);
      
    @@ builtin/multi-pack-index.c: static int cmd_multi_pack_index_repack(int argc, con
     -	struct option *options;
     -	static struct option builtin_multi_pack_index_repack_options[] = {
     +	static struct option options[] = {
    ++		MULTI_PACK_INDEX_COMMON_OPTIONS(&opts),
      		OPT_UNSIGNED(0, "batch-size", &opts.batch_size,
      		  N_("during repack, collect pack-files of smaller size into a batch that is larger than this size")),
    -+		MULTI_PACK_INDEX_COMMON_OPTIONS(&opts),
      		OPT_END(),
      	};
      	struct odb_source_packed *packed_source;
5:  d8ac43810193 ! 5:  46a59a5daf52 builtin/multi-pack-index: de-globalize options handling
    @@ builtin/multi-pack-index.c: static char const * const builtin_multi_pack_index_u
      
     -static struct opts_multi_pack_index {
     +struct opts_multi_pack_index {
    - 	char *object_dir;
    + 	const char *object_dir;
      	const char *preferred_pack;
      	const char *incremental_base;
     @@ builtin/multi-pack-index.c: static struct opts_multi_pack_index {
    @@ builtin/multi-pack-index.c: static struct opts_multi_pack_index {
      	unsigned flags;
      	int stdin_packs;
     -} opts;
    --
     +};
      
    - static int parse_object_dir(const struct option *opt, const char *arg,
    - 			    int unset)
    -@@ builtin/multi-pack-index.c: static int parse_object_dir(const struct option *opt, const char *arg,
    - 	return 0;
    - }
    - 
     -static struct odb_source_packed *handle_object_dir_option(struct repository *repo)
     +static struct odb_source_packed *handle_object_dir_option(struct repository *repo,
     +							  const char *object_dir)
    @@ builtin/multi-pack-index.c: static int cmd_multi_pack_index_write(int argc, cons
     -	static struct option options[] = {
     +	struct opts_multi_pack_index opts = { 0 };
     +	struct option options[] = {
    + 		MULTI_PACK_INDEX_COMMON_OPTIONS(&opts),
      		OPT_STRING(0, "preferred-pack", &opts.preferred_pack,
      			   N_("preferred-pack"),
    - 			   N_("pack for reuse when computing a multi-pack bitmap")),
     @@ builtin/multi-pack-index.c: static int cmd_multi_pack_index_write(int argc, const char **argv,
      
      	opts.flags |= MIDX_WRITE_BITMAP_HASH_CACHE;
    @@ builtin/multi-pack-index.c: static int cmd_multi_pack_index_write(int argc, cons
      
      	if (opts.stdin_packs) {
      		struct string_list packs = STRING_LIST_INIT_DUP;
    -@@ builtin/multi-pack-index.c: static int cmd_multi_pack_index_write(int argc, const char **argv,
    - 
    - 		string_list_clear(&packs, 0);
    - 		free(opts.refs_snapshot);
    -+		free(opts.object_dir);
    - 
    - 		return ret;
    - 
    -@@ builtin/multi-pack-index.c: static int cmd_multi_pack_index_write(int argc, const char **argv,
    - 			      opts.refs_snapshot, opts.flags);
    - 
    - 	free(opts.refs_snapshot);
    -+	free(opts.object_dir);
    - 	return ret;
    - }
    - 
     @@ builtin/multi-pack-index.c: static int cmd_multi_pack_index_compact(int argc, const char **argv,
      					const char *prefix,
      					struct repository *repo)
    @@ builtin/multi-pack-index.c: static int cmd_multi_pack_index_compact(int argc, co
      
     -	static struct option options[] = {
     +	struct option options[] = {
    + 		MULTI_PACK_INDEX_COMMON_OPTIONS(&opts),
      		OPT_STRING(0, "base", &opts.incremental_base, N_("checksum"),
      			   N_("base MIDX for incremental writes")),
    - 		OPT_BIT(0, "bitmap", &opts.flags, N_("write multi-pack bitmap"),
     @@ builtin/multi-pack-index.c: static int cmd_multi_pack_index_compact(int argc, const char **argv,
      		OPT_END(),
      	};
    @@ builtin/multi-pack-index.c: static int cmd_multi_pack_index_compact(int argc, co
      
      	m = get_multi_pack_index(packed_source);
      
    -@@ builtin/multi-pack-index.c: static int cmd_multi_pack_index_compact(int argc, const char **argv,
    - 	ret = write_midx_file_compact(packed_source, from_midx, to_midx,
    - 				      opts.incremental_base, opts.flags);
    - 
    -+	free(opts.object_dir);
    - 	return ret;
    - }
    - 
     @@ builtin/multi-pack-index.c: static int cmd_multi_pack_index_verify(int argc, const char **argv,
      				       const char *prefix,
      				       struct repository *repo)
    @@ builtin/multi-pack-index.c: static int cmd_multi_pack_index_verify(int argc, con
      		MULTI_PACK_INDEX_COMMON_OPTIONS(&opts),
      		OPT_END(),
      	};
    - 	struct odb_source_packed *packed_source;
    -+	int ret;
    - 
    - 	trace2_cmd_mode(argv[0]);
    - 
     @@ builtin/multi-pack-index.c: static int cmd_multi_pack_index_verify(int argc, const char **argv,
      	if (argc)
      		usage_with_options(builtin_multi_pack_index_verify_usage,
    @@ builtin/multi-pack-index.c: static int cmd_multi_pack_index_verify(int argc, con
     -	packed_source = handle_object_dir_option(repo);
     +	packed_source = handle_object_dir_option(repo, opts.object_dir);
      
    --	return verify_midx_file(packed_source, opts.flags);
    -+	ret = verify_midx_file(packed_source, opts.flags);
    -+
    -+	free(opts.object_dir);
    -+	return ret;
    + 	return verify_midx_file(packed_source, opts.flags);
      }
    - 
    - static int cmd_multi_pack_index_expire(int argc, const char **argv,
    +@@ builtin/multi-pack-index.c: static int cmd_multi_pack_index_expire(int argc, const char **argv,
      				       const char *prefix,
      				       struct repository *repo)
      {
    @@ builtin/multi-pack-index.c: static int cmd_multi_pack_index_verify(int argc, con
      		MULTI_PACK_INDEX_COMMON_OPTIONS(&opts),
      		OPT_END(),
      	};
    - 	struct odb_source_packed *packed_source;
    -+	int ret;
    - 
    - 	trace2_cmd_mode(argv[0]);
    - 
     @@ builtin/multi-pack-index.c: static int cmd_multi_pack_index_expire(int argc, const char **argv,
      	if (argc)
      		usage_with_options(builtin_multi_pack_index_expire_usage,
      				   options);
     -	packed_source = handle_object_dir_option(repo);
     +	packed_source = handle_object_dir_option(repo, opts.object_dir);
    -+
    -+	ret = expire_midx_packs(packed_source, opts.flags);
      
    --	return expire_midx_packs(packed_source, opts.flags);
    -+	free(opts.object_dir);
    -+	return ret;
    + 	return expire_midx_packs(packed_source, opts.flags);
      }
    - 
    - static int cmd_multi_pack_index_repack(int argc, const char **argv,
    +@@ builtin/multi-pack-index.c: static int cmd_multi_pack_index_repack(int argc, const char **argv,
      				       const char *prefix,
      				       struct repository *repo)
      {
     -	static struct option options[] = {
     +	struct opts_multi_pack_index opts = { 0 };
     +	struct option options[] = {
    + 		MULTI_PACK_INDEX_COMMON_OPTIONS(&opts),
      		OPT_UNSIGNED(0, "batch-size", &opts.batch_size,
      		  N_("during repack, collect pack-files of smaller size into a batch that is larger than this size")),
    - 		MULTI_PACK_INDEX_COMMON_OPTIONS(&opts),
    - 		OPT_END(),
    - 	};
    - 	struct odb_source_packed *packed_source;
    -+	int ret;
    - 
    - 	trace2_cmd_mode(argv[0]);
    - 
     @@ builtin/multi-pack-index.c: static int cmd_multi_pack_index_repack(int argc, const char **argv,
      	if (argc)
      		usage_with_options(builtin_multi_pack_index_repack_usage,
      				   options);
     -	packed_source = handle_object_dir_option(repo);
     +	packed_source = handle_object_dir_option(repo, opts.object_dir);
    -+
    -+	ret = midx_repack(packed_source, (size_t)opts.batch_size, opts.flags);
      
    --	return midx_repack(packed_source, (size_t)opts.batch_size, opts.flags);
    -+	free(opts.object_dir);
    -+	return ret;
    + 	return midx_repack(packed_source, (size_t)opts.batch_size, opts.flags);
      }
    - 
    - int cmd_multi_pack_index(int argc,
     @@ builtin/multi-pack-index.c: int cmd_multi_pack_index(int argc,
      			 const char *prefix,
      			 struct repository *repo)
    @@ builtin/multi-pack-index.c: int cmd_multi_pack_index(int argc,
      
     -	res = fn(argc, argv, prefix, repo);
     -
    --	free(opts.object_dir);
     -	return res;
     +	return fn(argc, argv, prefix, repo);
      }

base-commit: 86e79b2795e3ce3b0ad7685edd368574b0c8b9f2
-- 
2.56.0
Technical Details
Message-ID: <cover.1796147221.git.jltobler@gmail.com>
Path: mbox-mo1.pugleaf.net!news-lon.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!2.eu.feeder.erje.net!feeder.erje.net!feeder1.feed.ams11.usenet.farm!feed.usenet.farm!peer04.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!git+bounces-76813-linux-kernel-git=dewy.ru
References: <cover.1796075503.git.jltobler@gmail.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lon.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!2.eu.feeder.erje.net!feeder.erje.net!feeder1.feed.ams11.usenet.farm!feed.usenet.farm!peer04.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!git+bounces-76813-linux-kernel-git=dewy.ru
From: jltobler@gmail.com (Justin Tobler)
Newsgroups: linux.kernel.git
Subject: [PATCH v2 0/5] builtin/multi-pack-index: remove global state
Date: Tue,  1 Dec 2026 12:16:11 -0600
Organization: Usenet Network
Message-ID: <cover.1796147221.git.jltobler@gmail.com>
References: <cover.1796075503.git.jltobler@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network; logging-data="1786955"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:yobhKAjSC9b3n/1kUKwY1rtgLJE= sha256:frQEXqVzZ1x/72MWBr3e9fEFBcPKqA1x2CboBAAl/Do= sha1:toCmUm1k3isAVpMIx+Qj5fLIATo= sha256:p7WEZrPz/VLwZ5vN5MkRs7bB0a/94j8rHlCPJOm+ZWU=
List-ID: <git.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 8A75611744F; Tue,  1 Dec 2026 21:20:12 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.048
X-Spam-Status: No, score=-3.048 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com
X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id DzsKi3oIubKt; Tue,  1 Dec 2026 21:20:09 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=git+bounces-76813-linux-kernel-git=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=gmail.com
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id 9A53D117453; Tue,  1 Dec 2026 21:19:59 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id 5121C2ACEA; Tue,  1 Dec 2026 18:19:55 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796149194; b=lvGq5lGlZ5wv1vmquS0ULeCVuF6wkGi7+ajqTbs13Lg7I3VDLPzjdJHZR/O4sCBx0fhK x5qrlpHduqf3bsSG9JvXC1asdEuzUJyeXuHXFA7PPxjXZP6exE4kUXXKOFQDrDAVm1mS6 TH48rU5gTkWopDkQwLYdJ3sboqaZHDKxvoDoIB0dbD21JQ7oWPPR8P+G6KiLz9IAyD6Rf 6RvbSfUFcK4Y3yLxP3DUDYGkep7jMK0M824YawNDzaTOVtkPQXcfZnaQPZVflaiFv0MLl pxTHD1jitjKjvroszx+DAd4z5/7Qqh48UDNeg3ST+HHPDQOOZKWSl52RV/QyJVYZ79A==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796149194; h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature: X-Google-DKIM-Signature:X-Gm-Message-State:X-Gm-Gg:X-Received: Received:From:To:Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To: References:X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe: List-Unsubscribe:List-Owner:Precedence:MIME-Version: Content-Transfer-Encoding; bh=zVYI6F1xcbmx2W/MNEffwSYQjteLY9fKdQsk5CAS+Zw=; b=WSyj3VJT3eoqjK4F9uI2lNzV3fth7i9hBKGP2ZZVWFnCuRNPFL+C9bjkM2cfpFQNUMiI WBBjhxiUmyQuyvGxLE08Z8yohLh0J4JuYOyo2IzoEf0CJYBqpYFtv886PmQmC91JVsh9c RV9l2GTSt5TmshQJNQFoJ5oZEEX2LI4p28dLkQFkyb5u1OyrDB3aZq7qv7U4AbV3ibeum RlXDDLh0PMcFoedDyiv8+FZEpZaa1NgiZpGc58NPqiOg35FdP2P90mdY0zVn6bJVZpSO3 d86awge1CVYfWATVlwHI0ibZcb6IgOMJOHFMWhnq6Xh8+jQ85rEJ9aqdryGGIA+sVcg==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=JvZMmuIA; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 46EA1606A32A; Tue,  1 Dec 2026 18:19:54 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=JvZMmuIA
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.161.42
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796149193; b=hNnvJavXL2Xa6VF9zwRBE8mQ1zrWg9wiMOv8bWrsNOVTJhrbdImm3zmWZKSQ98Lk0eE7 mEYRso9uwv+/dv0yUS6DJYYxp9gH/h5R1ejYAEhpSw3tSTD9knvFiWs0/uXhocu5j4HsH kxd1BOXsawMJ8DhzDxRWoFSyeP9gAI3Y4T7tSMvLG1sN/GPqlR4yXc2dsasZcplA36K/K y0xgtK+WeJywm3tQyAhFg6FNxW46HLfK2Ep2ojkGHSb9Iewm2hBzMgNd054HqC7Ac4jNp sQStlQ2iu0s6695aLL8MHn13xa92n84EII1329SZ9CM/N5k6TLf6itDld/WpYjARUHg==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796149193; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Gm-Message-State:X-Gm-Gg:X-Received:Received:From:To:Cc:Subject: Date:Message-ID:X-Mailer:In-Reply-To:References:MIME-Version: Content-Transfer-Encoding; bh=zVYI6F1xcbmx2W/MNEffwSYQjteLY9fKdQsk5CAS+Zw=; b=oDffrm8v+gPfHT5j/uMTqnOiPnD6s/tYuclEhK+dS7ajzMwP0HJT4cte4yIIVPQ1cxcQ ja8CUUgXcuYqSs+i5UpSPZmTFdc+Jty/oK7xFO0UHZMihe8QtxRS3YjFDvUw8lqwoHfy0 8iUm4a0SfvxYBuoPK+eDXAQSOm6q0Ftg2/AcN2HBBi2+5kTmt61mnP7zWG1besiDCHNWs +YPHZK1ACZupjemZgqVdxAxZk+yMGBjtjTSxaFPFBZrRDNJU9l7eplc8QY/IyRVLWyXXx INwxqCKs4OOU/68W4eoY9hOMYu9TYcycvT/Dpo0Sk7YehXS7vA9ITdiQFYQSdcc+h/Q==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=JvZMmuIA; arc=none smtp.remote-ip=209.85.161.42
X-Received: from mail-oo1-f42.google.com (mail-oo1-f42.google.com [209.85.161.42]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C6313606A32E for <git@vger.kernel.org>; Tue,  1 Dec 2026 18:19:52 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org C6313606A32E
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
X-Received: by mail-oo1-f42.google.com with SMTP id 006d021491bc7-71bb0f27587so1835949eaf.0 for <git@vger.kernel.org>; Tue, 01 Dec 2026 10:19:52 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796149192; x=1796753992; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=zVYI6F1xcbmx2W/MNEffwSYQjteLY9fKdQsk5CAS+Zw=; b=JvZMmuIAdt1IqxhcderRTLz4hzrm/wQBQQQLAxi2RZUhuM03Nh/bA4Tyc78o+qVjQL auKzZ4KlFI7jfqqdXyVmd67Y30xxGYuXra26LWtB+NIOWNz9Mnn4+gBj1rv4y4TFaYSH Crimi6lGp2te9Bi9QFGauqKS5sEFlZtE6Gj8N/NsyL1SvW5f1WVSE3MvEflpPs4w8FxE 9gf1tYD4weY7CSVCoThm/n4p8twWjzEJjTuds0zV/MpymFGUD1CCAWIVaIBzq833ZRy4 qXBVNH0NaLAltJ12OGqqmocXcDuB9KcYYhkZwTjV329PtLbNfcMzGcXfjjJSozym2GkI HK+Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796149192; x=1796753992; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=zVYI6F1xcbmx2W/MNEffwSYQjteLY9fKdQsk5CAS+Zw=; b=VkdduNYkY/i3sIk1MQ5e3UKlvLe4RbMIe6ZtopIEVWeoR7gO9579UEo0hIOp5bZY3P qZh4J55fjd2THbyrKIGMQn6ZFJsAwe4KUx3HWEcVIBtCOI4exkt3CVpwXN0tKs9Jg/HY 6ReapmGm8sCpzf1wvXpDexLqKYZjV7KgyLaR9akkuebH4cco5uMKaSQra1A9zekwvxIu rbXbJpXseudrBVZsnVHSEfYbVs1/LRjay3jzgcpEupg1kGNZklFV4bPjjEQ3Gc6F6NPk DcLPJcpoOfUGE2NNyWr1F406AFoev8nzS833n9vNUSf26L5d7jdb1WnumLXRD1U5Jp2I naWQ==
X-Gm-Message-State: APuU4Z++LQamN7l4WYsldzfPqf+OpuDewz5KJeOJ3AypT6OsfJOtdx7f yF7ux0Uth0wiIsvOGGFq/K2OC1b7rVFncrpcelK63yinZNQzWYOeIwIO/Gll7g==
X-Gm-Gg: AZFdTZfDJEh1ZaIefrvHBZ0seV9A5gR7cVJWn/jwpx3VlYUKekTg1VDQfGz5v2r3BcA GDNe/eT13hOxqUi9zgdkSTKvvwQ7Aa/w/IKXfunjgL6/YVpfX+DsYXwF7SJ2xngdeL97qBldSeV PN3yLMqdYQWUDz8+s7K1h51XXVf59Dw6PzJLy6NZPNG8hY9rYmmME0cbxJUGKnt7w6lUHmCmN6Z c255rI8DOgvVvxOiCGLgPtoNsKx//ccZw/VfQXC0HXMrdgXzoCjzNGlzvJc+2Hw2TsScrkJByu0 dMRcdhv9QZRB36VctCLnd5sIwQzfJ37UsdiL+FU4P3HFnDpEzAtmLu772xf35lT03vlnWwSnzja T6uNGOTePWo6Xa7AKDCh8z5g5nvLM7Ht3S+U2MgBJZi8vIiWhsuQ2nIO301ldQygCsyjlTverVU +Uq87CY+TwQieAGGCmn3eqn2oeN2qTLb5jWStgtNbVX/qQjPTueJYVwLKp7NAkNboo0jy3ePGL2 ZdWRnOKwvPhyc8hTlVF1eIq+2ktRZCfFZt5I1sto5RUKKeqOshGYPxX2eA35IMQLoNreLfCsWYs Va9nFSQ5vWPUIY6vjJvusrh8t9F2eRMkpAp2cDAB5nPCePM5r3kxmjY5WqpFnSXoX5SAXtjJllz 1ExXXhDlKJ+fh
X-Received: by 2002:a05:6820:1ca1:b0:71b:87ac:6ec8 with SMTP id 006d021491bc7-71b87ac7f4amr17544601eaf.6.1796149191390; Tue, 01 Dec 2026 10:19:51 -0800 (PST)
X-Received: from jtobler--20250820-SHC54.localdomain ([136.51.44.64]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-863607d0f48sm16701271a34.7.2026.12.01.10.19.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Dec 2026 10:19:50 -0800 (PST)
X-Cc: ps@pks.im, Justin Tobler <jltobler@gmail.com>
X-Mailer: git-send-email 2.56.0
X-In-Reply-To: <cover.1796075503.git.jltobler@gmail.com>
X-Mailing-List: git@vger.kernel.org
X-List-Post: <mailto:git@vger.kernel.org>
X-List-Help: <mailto:git+help@vger.kernel.org>
X-List-Subscribe: <mailto:git+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:git+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:git+owner@vger.kernel.org>
X-Precedence: list
X-Received-Bytes: 34235