summaryrefslogtreecommitdiff
path: root/preload-index.c
diff options
context:
space:
mode:
authorBen Peart <benpeart@microsoft.com>2017-09-22 16:35:38 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-09-24 01:39:40 (GMT)
commit3e2c66961a9637f85eb9208466aca8f4430e89e0 (patch)
treee00b789ecbc903faa98324f6ffcc6f3d84d3d1bd /preload-index.c
parentb2e39d0067240e262d77f6c2ac133b77c56bcf1c (diff)
downloadgit-3e2c66961a9637f85eb9208466aca8f4430e89e0.zip
git-3e2c66961a9637f85eb9208466aca8f4430e89e0.tar.gz
git-3e2c66961a9637f85eb9208466aca8f4430e89e0.tar.bz2
preload-index: add override to enable testing preload-index
By default, the preload index code path doesn't run unless there is a minimum of 1000 files. To enable running the test suite and having it execute the preload-index path, add an environment variable (GIT_FORCE_PRELOAD_TEST) which will override that minimum and set it to 2. This enables you run existing tests and have the core.preloadindex code path execute as long as the test has at least 2 files by setting GIT_FORCE_PRELOAD_TEXT=1 before running the test. Signed-off-by: Ben Peart <benpeart@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'preload-index.c')
-rw-r--r--preload-index.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/preload-index.c b/preload-index.c
index 70a4c80..75564c4 100644
--- a/preload-index.c
+++ b/preload-index.c
@@ -79,6 +79,8 @@ static void preload_index(struct index_state *index,
return;
threads = index->cache_nr / THREAD_COST;
+ if ((index->cache_nr > 1) && (threads < 2) && getenv("GIT_FORCE_PRELOAD_TEST"))
+ threads = 2;
if (threads < 2)
return;
if (threads > MAX_PARALLEL)