preload-index: stop depending on 'the_repository'

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> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Ayush Chandekar committed Jun 10, 2025 at 18:32 UTC 1fde1c5daf399bb2d645261e38a7f4b8b1de04c6
1 file changed +2 -3
preload-index.c
+2 -3
@@ -2,7 +2,6 @@
2 * Copyright (C) 2008 Linus Torvalds
3 */
4
5 -#define USE_THE_REPOSITORY_VARIABLE
5 #define DISABLE_SIGN_COMPARE_WARNINGS
6
7 #include "git-compat-util.h"
@@ -114,7 +113,7 @@ void preload_index(struct index_state *index,
113 int t2_sum_lstat = 0;
114 int core_preload_index = 1;
115
117 - repo_config_get_bool(the_repository, "core.preloadindex", &core_preload_index);
116 + repo_config_get_bool(index->repo, "core.preloadindex", &core_preload_index);
117
118 if (!HAVE_THREADS || !core_preload_index)
119 return;
@@ -136,7 +135,7 @@ void preload_index(struct index_state *index,
135
136 memset(&pd, 0, sizeof(pd));
137 if (refresh_flags & REFRESH_PROGRESS && isatty(2)) {
139 - pd.progress = start_delayed_progress(the_repository,
138 + pd.progress = start_delayed_progress(index->repo,
139 _("Refreshing index"),
140 index->cache_nr);
141 pthread_mutex_init(&pd.mutex, NULL);