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>
return 0;
}
- if (!strcmp(var, "core.preloadindex")) {
- core_preload_index = git_config_bool(var, value);
- return 0;
- }
-
if (!strcmp(var, "core.createobject")) {
if (!value)
return config_error_nonbool(var);
char *comment_line_str_to_free;
int auto_comment_line_char;
-/* Parallel index stat data preload? */
-int core_preload_index = 1;
-
/* This is set by setup_git_directory_gently() and/or git_default_config() */
char *git_work_tree_cfg;
extern unsigned long pack_size_limit_cfg;
extern int max_allowed_tree_depth;
-extern int core_preload_index;
extern int precomposed_unicode;
extern int protect_hfs;
extern int protect_ntfs;
#include "repository.h"
#include "symlinks.h"
#include "trace2.h"
+#include "config.h"
/*
* Mostly randomly chosen maximum thread counts: we
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;