Changes this round are to use Junio's more elegant script to test and warn
about using old variables and munging which changes are in which commit.

Base Ref: v2.19.0
Web-Diff: https://github.com/benpeart/git/commit/79d62d39e4
Checkout: git fetch https://github.com/benpeart/git git-test-cleanup-v2 && git 
checkout 79d62d39e4


### Interdiff (v1..v2):

diff --git a/t/test-lib.sh b/t/test-lib.sh
index 3f447b8ddc..17a56f44ad 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -140,38 +140,27 @@ then
        export GIT_INDEX_VERSION
 fi
 
-if test -n "$TEST_GIT_INDEX_VERSION"
-then
-       if test -n "$GIT_TEST_INDEX_VERSION"
-       then
-               echo "warning: the TEST_GIT_INDEX_VERSION variable has been 
renamed to GIT_TEST_INDEX_VERSION"
-       else
-               echo "error: the TEST_GIT_INDEX_VERSION variable has been 
renamed to GIT_TEST_INDEX_VERSION"
-               exit 1
-       fi
-fi
-
-if test -n "$GIT_FSMONITOR_TEST"
-then
-       if test -n "$GIT_TEST_FSMONITOR"
-       then
-               echo "warning: the GIT_FSMONITOR_TEST variable has been renamed 
to GIT_TEST_FSMONITOR"
-       else
-               echo "error: the GIT_FSMONITOR_TEST variable has been renamed 
to GIT_TEST_FSMONITOR"
-               exit 1
-       fi
-fi
+check_var_migration () {
+       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
+}
 
-if test -n "$GIT_FORCE_PRELOAD_TEST"
-then
-       if test -n "$GIT_TEST_PRELOAD_INDEX"
-       then
-               echo "warning: the GIT_FORCE_PRELOAD_TEST variable has been 
renamed to GIT_TEST_PRELOAD_INDEX"
-       else
-               echo "error: the GIT_FORCE_PRELOAD_TEST variable has been 
renamed to GIT_TEST_PRELOAD_INDEX"
-               exit 1
-       fi
-fi
+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
 
 # Add libc MALLOC and MALLOC_PERTURB test
 # only if we are not executing the test with valgrind


### Patches

Ben Peart (5):
  correct typo/spelling error in t/README
  preload-index: teach GIT_FORCE_PRELOAD_TEST to take a boolean
  fsmonitor: update GIT_TEST_FSMONITOR support
  read-cache: update TEST_GIT_INDEX_VERSION support
  preload-index: update GIT_FORCE_PRELOAD_TEST support

 Makefile                    |  6 +++---
 config.c                    |  2 +-
 preload-index.c             |  3 ++-
 t/README                    | 13 ++++++++++++-
 t/t1700-split-index.sh      |  2 +-
 t/t7519-status-fsmonitor.sh |  6 +++---
 t/test-lib.sh               | 26 ++++++++++++++++++++++++--
 7 files changed, 46 insertions(+), 12 deletions(-)


base-commit: 1d4361b0f344188ab5eec6dcea01f61a3a3a1670
-- 
2.18.0.windows.1


Reply via email to