preload-index: update GIT_FORCE_PRELOAD_TEST support
authorBen Peart <benpeart@microsoft.com>
Tue, 18 Sep 2018 23:29:37 +0000 (23:29 +0000)
committerJunio C Hamano <gitster@pobox.com>
Fri, 28 Sep 2018 18:41:01 +0000 (11:41 -0700)
Rename GIT_FORCE_PRELOAD_TEST to GIT_TEST_PRELOAD_INDEX for consistency with
the other GIT_TEST_ special setups and properly document its use.

Add logic in t/test-lib.sh to give a warning when the old variable is set to
let people know they need to update their environment to use the new
variable.

Signed-off-by: Ben Peart <Ben.Peart@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
preload-index.c
t/README
t/t7519-status-fsmonitor.sh
t/test-lib.sh
index 0a4e2933bb6eca181b529c288aa9ac017138c349..a850e197c29db6bdffe7c167329e1ee12842ae50 100644 (file)
@@ -85,7 +85,7 @@ static void preload_index(struct index_state *index,
                return;
 
        threads = index->cache_nr / THREAD_COST;
-       if ((index->cache_nr > 1) && (threads < 2) && git_env_bool("GIT_FORCE_PRELOAD_TEST", 0))
+       if ((index->cache_nr > 1) && (threads < 2) && git_env_bool("GIT_TEST_PRELOAD_INDEX", 0))
                threads = 2;
        if (threads < 2)
                return;
index 9b13f6d12e83da0415494fd91728374403fcd815..5670c7aad0ad10dcc55c8a6923b19a362c365776 100644 (file)
--- a/t/README
+++ b/t/README
@@ -327,6 +327,9 @@ GIT_TEST_INDEX_VERSION=<n> exercises the index read/write code path
 for the index version specified.  Can be set to any valid version
 (currently 2, 3, or 4).
 
+GIT_TEST_PRELOAD_INDEX=<boolean> exercises the preload-index code path
+by overriding the minimum number of cache entries required per thread.
+
 Naming Tests
 ------------
 
index 06f59822e4017ce1672d6bda3510bcd3a0fb850a..3f0dd980106c035329cb640838d91730c20b13fd 100755 (executable)
@@ -238,9 +238,9 @@ do
                git config core.preloadIndex $preload_val &&
                if test $preload_val = true
                then
-                       GIT_FORCE_PRELOAD_TEST=$preload_val; export GIT_FORCE_PRELOAD_TEST
+                       GIT_TEST_PRELOAD_INDEX=$preload_val; export GIT_TEST_PRELOAD_INDEX
                else
-                       unset GIT_FORCE_PRELOAD_TEST
+                       sane_unset GIT_TEST_PRELOAD_INDEX
                fi
        '
 
index e80c84d13c398303681597450f7c8416a3aa44f5..8ef86e05a35fa2022a4138f6d9a6433a857e0dec 100644 (file)
@@ -154,6 +154,7 @@ check_var_migration () {
 
 check_var_migration GIT_FSMONITOR_TEST GIT_TEST_FSMONITOR
 check_var_migration TEST_GIT_INDEX_VERSION GIT_TEST_INDEX_VERSION
+check_var_migration GIT_FORCE_PRELOAD_TEST GIT_TEST_PRELOAD_INDEX
 
 # Use specific version of the index file format
 if test -n "${GIT_TEST_INDEX_VERSION:+isset}"