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

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

From
Justin Tobler <jltobler@gmail.com>
Date
Nov 30, 2026, 21:54 UTC
Message-ID
<673945d65de346762178b675ad6d0de9606cc6ca.1796075503.git.jltobler@gmail.com>
In-Reply-To
<cover.1796075503.git.jltobler@gmail.com>

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.

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 1a27d523c7ab..8528f4f513ef 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 "abspath.h"
 #include "config.h"
@@ -180,7 +179,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);
 
@@ -286,7 +285,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);
 
@@ -321,7 +320,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[] = {
@@ -341,7 +340,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);
 
@@ -350,7 +349,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[] = {
@@ -370,7 +369,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);
 
@@ -379,7 +378,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[] = {
@@ -402,7 +401,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);
 
@@ -428,7 +427,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: Justin ToblerNext: Patrick Steinhardt
Message 5 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.