read-cache.c: make $GIT_TEST_SPLIT_INDEX boolean

While at there, document about this special mode when running the test suite. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Nguyễn Thái Ngọc Duy committed Apr 14, 2018 at 17:34 UTC 4c2db93807f5ab65976a901b562e4bc8d69d40bf
3 files changed +14 -3
ci/run-build-and-tests.sh
+1 -1
@@ -11,7 +11,7 @@ make --jobs=2
11 make --quiet test
12 if test "$jobname" = "linux-gcc"
13 then
14 - GIT_TEST_SPLIT_INDEX=YesPlease make --quiet test
14 + GIT_TEST_SPLIT_INDEX=yes make --quiet test
15 fi
16
17 check_unignored_build_artifacts
read-cache.c
+2 -2
@@ -2268,7 +2268,7 @@ static int do_write_index(struct index_state *istate, struct tempfile *tempfile,
2268
2269 if (!istate->version) {
2270 istate->version = get_index_format_default();
2271 - if (getenv("GIT_TEST_SPLIT_INDEX"))
2271 + if (git_env_bool("GIT_TEST_SPLIT_INDEX", 0))
2272 init_split_index(istate);
2273 }
2274
@@ -2559,7 +2559,7 @@ int write_locked_index(struct index_state *istate, struct lock_file *lock,
2559 goto out;
2560 }
2561
2562 - if (getenv("GIT_TEST_SPLIT_INDEX")) {
2562 + if (git_env_bool("GIT_TEST_SPLIT_INDEX", 0)) {
2563 int v = si->base_sha1[0];
2564 if ((v & 15) < 6)
2565 istate->cache_changed |= SPLIT_INDEX_ORDERED;
t/README
+11
@@ -293,6 +293,17 @@ and know what setup is needed for it. Or when you want to run
293 everything up to a certain test.
294
295
296 +Running tests with special setups
297 +---------------------------------
298 +
299 +The whole test suite could be run to test some special features
300 +that cannot be easily covered by a few specific test cases. These
301 +could be enabled by running the test suite with correct GIT_TEST_
302 +environment set.
303 +
304 +GIT_TEST_SPLIT_INDEX=<boolean> forces split-index mode on the whole
305 +test suite. Accept any boolean values that are accepted by git-config.
306 +
307 Naming Tests
308 ------------
309