diff options
author | Junio C Hamano <gitster@pobox.com> | 2018-10-19 04:34:03 (GMT) |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-10-19 04:34:03 (GMT) |
commit | 340fde61bea189b87268aa20581e243deb744577 (patch) | |
tree | 90d4144aea9a2ee2d48a464e18aa3284e7029d7b /t/test-lib.sh | |
parent | 929e85ade811a1adaa573f79130b35843bed805e (diff) | |
parent | 4231d1ba995379974401062349c3281d7a821be5 (diff) | |
download | git-340fde61bea189b87268aa20581e243deb744577.zip git-340fde61bea189b87268aa20581e243deb744577.tar.gz git-340fde61bea189b87268aa20581e243deb744577.tar.bz2 |
Merge branch 'bp/rename-test-env-var'
Some environment variables that control the runtime options of Git
used during tests are getting renamed for consistency.
* bp/rename-test-env-var:
t0000: do not get self-test disrupted by environment warnings
preload-index: update GIT_FORCE_PRELOAD_TEST support
read-cache: update TEST_GIT_INDEX_VERSION support
fsmonitor: update GIT_TEST_FSMONITOR support
preload-index: use git_env_bool() not getenv() for customization
t/README: correct spelling of "uncommon"
Diffstat (limited to 't/test-lib.sh')
-rw-r--r-- | t/test-lib.sh | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/t/test-lib.sh b/t/test-lib.sh index 3f95bfd..897e6fc 100644 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -134,9 +134,40 @@ export EDITOR GIT_TRACE_BARE=1 export GIT_TRACE_BARE -if test -n "${TEST_GIT_INDEX_VERSION:+isset}" +check_var_migration () { + # the warnings and hints given from this helper depends + # on end-user settings, which will disrupt the self-test + # done on the test framework itself. + case "$GIT_TEST_FRAMEWORK_SELFTEST" in + t) return ;; + esac + + old_name=$1 new_name=$2 + eval "old_isset=\${${old_name}:+isset}" + eval "new_isset=\${${new_name}:+isset}" + + case "$old_isset,$new_isset" in + isset,) + echo >&2 "warning: $old_name is now $new_name" + echo >&2 "hint: set $new_name too during the transition period" + eval "$new_name=\$$old_name" + ;; + isset,isset) + # do this later + # echo >&2 "warning: $old_name is now $new_name" + # echo >&2 "hint: remove $old_name" + ;; + esac +} + +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}" then - GIT_INDEX_VERSION="$TEST_GIT_INDEX_VERSION" + GIT_INDEX_VERSION="$GIT_TEST_INDEX_VERSION" export GIT_INDEX_VERSION fi |