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

[GSOC PATCH 2/2] preload-index: stop depending on 'the_repository'

From
Ayush Chandekar <ayu.chandekar@gmail.com>
Date
Jun 10, 2025, 13:02 UTC
Message-ID
<505a6ee8a55397fc5cdfc6f003861f6fefab29d1.1749557133.git.ayu.chandekar@gmail.com>
In-Reply-To
<cover.1749557133.git.ayu.chandekar@gmail.com>

Refactor "preload-index.c" to remove the dependency on the global 'the_repository'. Replace the occurrences of 'the_repository' with 'index->repo' and thus remove the definition '#define USE_THE_REPOSITORY_VARIABLE'.

Mentored-by: Christian Couder <christian.couder@gmail.com>
Mentored-by: Ghanshyam Thakkar <shyamthakkar001@gmail.com>
Signed-off-by: Ayush Chandekar <ayu.chandekar@gmail.com>
---
 preload-index.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/preload-index.c b/preload-index.c
index 9fee4cc3aa..b222821b44 100644
--- a/preload-index.c
+++ b/preload-index.c
@@ -2,7 +2,6 @@
  * Copyright (C) 2008 Linus Torvalds
  */
 
-#define USE_THE_REPOSITORY_VARIABLE
 #define DISABLE_SIGN_COMPARE_WARNINGS
 
 #include "git-compat-util.h"
@@ -114,7 +113,7 @@ void preload_index(struct index_state *index,
 	int t2_sum_lstat = 0;
 	int core_preload_index = 1;
 
-	repo_config_get_bool(the_repository, "core.preloadindex", &core_preload_index);
+	repo_config_get_bool(index->repo, "core.preloadindex", &core_preload_index);
 
 	if (!HAVE_THREADS || !core_preload_index)
 		return;
@@ -136,7 +135,7 @@ void preload_index(struct index_state *index,
 
 	memset(&pd, 0, sizeof(pd));
 	if (refresh_flags & REFRESH_PROGRESS && isatty(2)) {
-		pd.progress = start_delayed_progress(the_repository,
+		pd.progress = start_delayed_progress(index->repo,
 						     _("Refreshing index"),
 						     index->cache_nr);
 		pthread_mutex_init(&pd.mutex, NULL);
-- 
2.49.0
Previous: Ayush ChandekarNext: Junio C Hamano
Message 3 of 4 in “preload-index: remove dependency on global variables and 'the_repository'”
  1. 0/2 preload-index: remove dependency on global variables and 'the_repository'Ayush Chandekar, Jun 10, 2025
  2. 1/2 environment: remove the global variable 'core_preload_index'Ayush Chandekar, Jun 10, 2025
  3. 2/2 preload-index: stop depending on 'the_repository'Ayush Chandekar, Jun 10, 2025
  4. Junio C HamanoJun 10, 2025

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.