aboutsummaryrefslogtreecommitdiffstats
path: root/preload-index.c
diff options
context:
space:
mode:
authorAyush Chandekar <ayu.chandekar@gmail.com>2025-06-10 18:32:20 +0530
committerJunio C Hamano <gitster@pobox.com>2025-06-10 10:10:38 -0700
commitb1d47b464e553331c555f122c5e341dfbfb618bd (patch)
tree0cbf0b6d2c635c89fb014be019aa1fb9dd725100 /preload-index.c
parentGit 2.50-rc2 (diff)
downloadgit-b1d47b464e553331c555f122c5e341dfbfb618bd.tar.gz
git-b1d47b464e553331c555f122c5e341dfbfb618bd.zip
environment: remove the global variable 'core_preload_index'
The global variable 'core_preload_index' is used in a single function named 'preload_index()' in "preload-index.c". Move its declaration inside that function, removing unnecessary global state. This change is part of an ongoing effort to eliminate global variables, improve modularity and help libify the codebase. 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>
Diffstat (limited to 'preload-index.c')
-rw-r--r--preload-index.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/preload-index.c b/preload-index.c
index 40ab2abafb..9fee4cc3aa 100644
--- a/preload-index.c
+++ b/preload-index.c
@@ -19,6 +19,7 @@
#include "repository.h"
#include "symlinks.h"
#include "trace2.h"
+#include "config.h"
/*
* Mostly randomly chosen maximum thread counts: we
@@ -111,6 +112,9 @@ void preload_index(struct index_state *index,
struct thread_data data[MAX_PARALLEL];
struct progress_data pd;
int t2_sum_lstat = 0;
+ int core_preload_index = 1;
+
+ repo_config_get_bool(the_repository, "core.preloadindex", &core_preload_index);
if (!HAVE_THREADS || !core_preload_index)
return;