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

[PATCH v2 2/5] builtin/multi-pack-index: get rid of `the_repository`

From
Justin Tobler <jltobler@gmail.com>
Date
Dec 1, 2026, 18:16 UTC
Message-ID
<28d7916f0a24c2cc382f86940af0459bf85b9a6e.1796147221.git.jltobler@gmail.com>
In-Reply-To
<cover.1796147221.git.jltobler@gmail.com>

There are a couple of remaining references to `the_repository` in 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 | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)
diff --git a/builtin/multi-pack-index.c b/builtin/multi-pack-index.c
index ba5f326dd6ef..c1ad8ebbcc15 100644
--- a/builtin/multi-pack-index.c
+++ b/builtin/multi-pack-index.c
@@ -1,4 +1,3 @@
-#define USE_THE_REPOSITORY_VARIABLE
 #include "builtin.h"
 #include "config.h"
 #include "environment.h"
@@ -164,7 +163,7 @@ static int cmd_multi_pack_index_write(int argc, const char **argv,
 
 	opts.flags |= MIDX_WRITE_BITMAP_HASH_CACHE;
 
-	repo_config(the_repository, git_multi_pack_index_write_config, NULL);
+	repo_config(repo, git_multi_pack_index_write_config, NULL);
 
 	options = add_common_options(builtin_multi_pack_index_write_options);
 
@@ -270,7 +269,7 @@ static int cmd_multi_pack_index_compact(int argc, const char **argv,
 				   options);
 	}
 
-	packed_source = handle_object_dir_option(the_repository);
+	packed_source = handle_object_dir_option(repo);
 
 	FREE_AND_NULL(options);
 
@@ -305,7 +304,7 @@ static int cmd_multi_pack_index_compact(int argc, const char **argv,
 
 static int cmd_multi_pack_index_verify(int argc, const char **argv,
 				       const char *prefix,
-				       struct repository *repo UNUSED)
+				       struct repository *repo)
 {
 	struct option *options;
 	static struct option builtin_multi_pack_index_verify_options[] = {
@@ -325,7 +324,7 @@ static int cmd_multi_pack_index_verify(int argc, const char **argv,
 	if (argc)
 		usage_with_options(builtin_multi_pack_index_verify_usage,
 				   options);
-	packed_source = handle_object_dir_option(the_repository);
+	packed_source = handle_object_dir_option(repo);
 
 	FREE_AND_NULL(options);
 
@@ -334,7 +333,7 @@ static int cmd_multi_pack_index_verify(int argc, const char **argv,
 
 static int cmd_multi_pack_index_expire(int argc, const char **argv,
 				       const char *prefix,
-				       struct repository *repo UNUSED)
+				       struct repository *repo)
 {
 	struct option *options;
 	static struct option builtin_multi_pack_index_expire_options[] = {
@@ -354,7 +353,7 @@ 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(the_repository);
+	packed_source = handle_object_dir_option(repo);
 
 	FREE_AND_NULL(options);
 
@@ -363,7 +362,7 @@ static int cmd_multi_pack_index_expire(int argc, const char **argv,
 
 static int cmd_multi_pack_index_repack(int argc, const char **argv,
 				       const char *prefix,
-				       struct repository *repo UNUSED)
+				       struct repository *repo)
 {
 	struct option *options;
 	static struct option builtin_multi_pack_index_repack_options[] = {
@@ -386,7 +385,7 @@ 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(the_repository);
+	packed_source = handle_object_dir_option(repo);
 
 	FREE_AND_NULL(options);
 
@@ -412,7 +411,7 @@ int cmd_multi_pack_index(int argc,
 
 	disable_replace_refs();
 
-	repo_config(the_repository, git_default_config, NULL);
+	repo_config(repo, git_default_config, NULL);
 
 	argc = parse_options(argc, argv, prefix, options,
 			     builtin_multi_pack_index_usage, 0);
-- 
2.56.0
Previous: Patrick SteinhardtNext: Justin Tobler
Message 20 of 25 in “builtin/multi-pack-index: remove global state”
  1. 0/5 builtin/multi-pack-index: remove global stateJustin Tobler, Nov 30, 2026
  2. 1/5 builtin/multi-pack-index: resolve default object directory lazilyJustin Tobler, Nov 30, 2026
  3. Patrick SteinhardtDec 1, 2026
  4. Justin ToblerDec 1, 2026
  5. 2/5 builtin/multi-pack-index: get rid of `the_repository`Justin Tobler, Nov 30, 2026
  6. Patrick SteinhardtDec 1, 2026
  7. Justin ToblerDec 1, 2026
  8. 3/5 builtin/multi-pack-index: drop top-level optionsJustin Tobler, Nov 30, 2026
  9. Patrick SteinhardtDec 1, 2026
  10. Justin ToblerDec 1, 2026
  11. 4/5 builtin/multi-pack-index: simplify how common options are wired upJustin Tobler, Nov 30, 2026
  12. Patrick SteinhardtDec 1, 2026
  13. Justin ToblerDec 1, 2026
  14. 5/5 builtin/multi-pack-index: de-globalize options handlingJustin Tobler, Nov 30, 2026
  15. Patrick SteinhardtDec 1, 2026
  16. Justin ToblerDec 1, 2026
  17. 0/5 builtin/multi-pack-index: remove global stateJustin Tobler, Dec 1, 2026
  18. 1/5 builtin/multi-pack-index: resolve default object directory lazilyJustin Tobler, Dec 1, 2026
  19. Patrick SteinhardtDec 2, 2026
  20. 2/5 builtin/multi-pack-index: get rid of `the_repository`Justin Tobler, Dec 1, 2026
  21. 3/5 builtin/multi-pack-index: drop top-level optionsJustin Tobler, Dec 1, 2026
  22. 4/5 builtin/multi-pack-index: simplify how common options are wired upJustin Tobler, Dec 1, 2026
  23. 5/5 builtin/multi-pack-index: de-globalize options handlingJustin Tobler, Dec 1, 2026
  24. Patrick SteinhardtDec 2, 2026
  25. Patrick SteinhardtDec 2, 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.