Skip to content

Commit 3e2c669

Browse files
benpeartgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent b2e39d0 commit 3e2c669

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

preload-index.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ static void preload_index(struct index_state *index,
7979
return;
8080

8181
threads = index->cache_nr / THREAD_COST;
82+
if ((index->cache_nr > 1) && (threads < 2) && getenv("GIT_FORCE_PRELOAD_TEST"))
83+
threads = 2;
8284
if (threads < 2)
8385
return;
8486
if (threads > MAX_PARALLEL)

0 commit comments

Comments
 (0)