fsmonitor: update GIT_TEST_FSMONITOR support
authorBen Peart <benpeart@microsoft.com>
Tue, 18 Sep 2018 23:29:35 +0000 (23:29 +0000)
committerJunio C Hamano <gitster@pobox.com>
Fri, 28 Sep 2018 18:40:38 +0000 (11:40 -0700)
Rename GIT_FSMONITOR_TEST to GIT_TEST_FSMONITOR 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.

Remove the outdated instructions on how to run the test suite utilizing
fsmonitor now that it is properly documented in t/README.

Signed-off-by: Ben Peart <Ben.Peart@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
config.c
t/README
t/t1700-split-index.sh
t/t7519-status-fsmonitor.sh
t/test-lib.sh
index 3461993f0af665d64b48d16915fc2cd017634377..3555c63f284e6f80793e1ab341d4b9894f3a813e 100644 (file)
--- a/config.c
+++ b/config.c
@@ -2278,7 +2278,7 @@ int git_config_get_max_percent_split_change(void)
 int git_config_get_fsmonitor(void)
 {
        if (git_config_get_pathname("core.fsmonitor", &core_fsmonitor))
-               core_fsmonitor = getenv("GIT_FSMONITOR_TEST");
+               core_fsmonitor = getenv("GIT_TEST_FSMONITOR");
 
        if (core_fsmonitor && !*core_fsmonitor)
                core_fsmonitor = NULL;
index 56a417439c2575f616e7a9bb87177efefe9e6b52..47165f7eabf7ccd54e68e8856abcaa72b73f66cd 100644 (file)
--- a/t/README
+++ b/t/README
@@ -319,6 +319,10 @@ GIT_TEST_OE_DELTA_SIZE=<n> exercises the uncommon pack-objects code
 path where deltas larger than this limit require extra memory
 allocation for bookkeeping.
 
+GIT_TEST_FSMONITOR=$PWD/t7519/fsmonitor-all exercises the fsmonitor
+code path for utilizing a file system monitor to speed up detecting
+new or changed files.
+
 Naming Tests
 ------------
 
index b3b4d83eafc4a031618a3a89fd8ca50353f1a844..f6a856f24c8c4c08e7a664041b1b9a9885970b24 100755 (executable)
@@ -6,7 +6,7 @@ test_description='split index mode tests'
 
 # We need total control of index splitting here
 sane_unset GIT_TEST_SPLIT_INDEX
-sane_unset GIT_FSMONITOR_TEST
+sane_unset GIT_TEST_FSMONITOR
 
 test_expect_success 'enable split index' '
        git config splitIndex.maxPercentChange 100 &&
index 756beb0d8eb466d78b235af363b6a36dde37c79e..06f59822e4017ce1672d6bda3510bcd3a0fb850a 100755 (executable)
@@ -4,13 +4,6 @@ test_description='git status with file system watcher'
 
 . ./test-lib.sh
 
-#
-# To run the entire git test suite using fsmonitor:
-#
-# copy t/t7519/fsmonitor-all to a location in your path and then set
-# GIT_FSMONITOR_TEST=fsmonitor-all and run your tests.
-#
-
 # Note, after "git reset --hard HEAD" no extensions exist other than 'TREE'
 # "git update-index --fsmonitor" can be used to get the extension written
 # before testing the results.
index 44288cbb598435a5dfff05e8e895cca85e53e804..653688c067406faa961b0d6967f531ec7d7ba030 100644 (file)
@@ -140,6 +140,26 @@ then
        export GIT_INDEX_VERSION
 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
+}
+
+check_var_migration GIT_FSMONITOR_TEST GIT_TEST_FSMONITOR
+
 # Add libc MALLOC and MALLOC_PERTURB test
 # only if we are not executing the test with valgrind
 if expr " $GIT_TEST_OPTS " : ".* --valgrind " >/dev/null ||