read-cache: update TEST_GIT_INDEX_VERSION support

Rename TEST_GIT_INDEX_VERSION to GIT_TEST_INDEX_VERSION 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>

Ben Peart committed Sep 18, 2018 at 23:29 UTC 1f357b045b503873626a72ac97797352a3cd2e87
3 files changed +15 -9
Makefile
+3 -3
@@ -400,7 +400,7 @@ all::
400 # (defaults to "man") if you want to have a different default when
401 # "git help" is called without a parameter specifying the format.
402 #
403 -# Define TEST_GIT_INDEX_VERSION to 2, 3 or 4 to run the test suite
403 +# Define GIT_TEST_INDEX_VERSION to 2, 3 or 4 to run the test suite
404 # with a different indexfile format version. If it isn't set the index
405 # file format used is index-v[23].
406 #
@@ -2599,8 +2599,8 @@ endif
2599 ifdef GIT_INTEROP_MAKE_OPTS
2600 @echo GIT_INTEROP_MAKE_OPTS=\''$(subst ','\'',$(subst ','\'',$(GIT_INTEROP_MAKE_OPTS)))'\' >>$@+
2601 endif
2602 -ifdef TEST_GIT_INDEX_VERSION
2603 - @echo TEST_GIT_INDEX_VERSION=\''$(subst ','\'',$(subst ','\'',$(TEST_GIT_INDEX_VERSION)))'\' >>$@+
2602 +ifdef GIT_TEST_INDEX_VERSION
2603 + @echo GIT_TEST_INDEX_VERSION=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_INDEX_VERSION)))'\' >>$@+
2604 endif
2605 @if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi
2606
t/README
+4
@@ -323,6 +323,10 @@ GIT_TEST_FSMONITOR=$PWD/t7519/fsmonitor-all exercises the fsmonitor
323 code path for utilizing a file system monitor to speed up detecting
324 new or changed files.
325
326 +GIT_TEST_INDEX_VERSION=<n> exercises the index read/write code path
327 +for the index version specified. Can be set to any valid version
328 +(currently 2, 3, or 4).
329 +
330 Naming Tests
331 ------------
332
t/test-lib.sh
+8 -6
@@ -134,12 +134,6 @@ export EDITOR
134 GIT_TRACE_BARE=1
135 export GIT_TRACE_BARE
136
137 -if test -n "${TEST_GIT_INDEX_VERSION:+isset}"
138 -then
139 - GIT_INDEX_VERSION="$TEST_GIT_INDEX_VERSION"
140 - export GIT_INDEX_VERSION
141 -fi
142 -
137 check_var_migration () {
138 old_name=$1 new_name=$2
139 eval "old_isset=\${${old_name}:+isset}"
@@ -159,6 +153,14 @@ check_var_migration () {
153 }
154
155 check_var_migration GIT_FSMONITOR_TEST GIT_TEST_FSMONITOR
156 +check_var_migration TEST_GIT_INDEX_VERSION GIT_TEST_INDEX_VERSION
157 +
158 +# Use specific version of the index file format
159 +if test -n "${GIT_TEST_INDEX_VERSION:+isset}"
160 +then
161 + GIT_INDEX_VERSION="$GIT_TEST_INDEX_VERSION"
162 + export GIT_INDEX_VERSION
163 +fi
164
165 # Add libc MALLOC and MALLOC_PERTURB test
166 # only if we are not executing the test with valgrind