summaryrefslogtreecommitdiff
path: root/config.c
diff options
context:
space:
mode:
authorBen Peart <benpeart@microsoft.com>2018-10-10 15:59:35 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-10-11 06:32:48 (GMT)
commitc780b9cfe8d79331ed9797e328b1bf80666c4ac2 (patch)
tree3d842486adb1555fbc23590c9a89fd9c1835a52b /config.c
parent3b1d9e045e1ad6c2cd5cbe668ccb740a82b50efb (diff)
downloadgit-c780b9cfe8d79331ed9797e328b1bf80666c4ac2.zip
git-c780b9cfe8d79331ed9797e328b1bf80666c4ac2.tar.gz
git-c780b9cfe8d79331ed9797e328b1bf80666c4ac2.tar.bz2
config: add new index.threads config setting
Add support for a new index.threads config setting which will be used to control the threading code in do_read_index(). A value of 0 will tell the index code to automatically determine the correct number of threads to use. A value of 1 will make the code single threaded. A value greater than 1 will set the maximum number of threads to use. For testing purposes, this setting can be overwritten by setting the GIT_TEST_INDEX_THREADS=<n> environment variable to a value greater than 0. Signed-off-by: Ben Peart <benpeart@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'config.c')
-rw-r--r--config.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/config.c b/config.c
index 3461993..2ee29f6 100644
--- a/config.c
+++ b/config.c
@@ -2289,6 +2289,24 @@ int git_config_get_fsmonitor(void)
return 0;
}
+int git_config_get_index_threads(void)
+{
+ int is_bool, val = 0;
+
+ val = git_env_ulong("GIT_TEST_INDEX_THREADS", 0);
+ if (val)
+ return val;
+
+ if (!git_config_get_bool_or_int("index.threads", &is_bool, &val)) {
+ if (is_bool)
+ return val ? 0 : 1;
+ else
+ return val;
+ }
+
+ return 0; /* auto */
+}
+
NORETURN
void git_die_config_linenr(const char *key, const char *filename, int linenr)
{