Justin Tobler's series removes both the_repository and the global option state from builtin/multi-pack-index.c. Each subcommand parses its options into a local structure. The config callback for "write" and "compact" receives the options as callback data instead of reading a global.

The global state existed because "--object-dir=" and "--[no-]progress" are also accepted before the subcommand, where the top-level builtin parsed them into the shared state. Patch 3 drops support for that placement. Tobler notes that every subcommand already accepts both options and that the calling convention is atypical for Git commands. The top-level "--[no-]progress" had already been disabled in 0394f8d002 (2021), and when given before the subcommand it was not always respected.

Another patch defines the common options through a preprocessor macro. This replaces a helper that concatenated them with each subcommand's array, which meant allocating and freeing a separate options array per subcommand. A further patch makes the object directory default lazy, falling back to the primary source's path in handle_object_dir_option(). The remaining references to the_repository are replaced by the repository passed to the builtin. Tobler notes that it may still be NULL before parse_options() runs, and that the only earlier use is repo_config(), which handles NULL.

In replies to review, Tobler said that with the changes suggested for patch 1, the object directory no longer needs to be allocated or freed. He will leave the existing refs_snapshot handling as it is, and he will move the common options to the front of the options arrays in the next version.