t7527: test FSMonitor on case insensitive+preserving file system

Test that FS events from the OS are received using the preserved, on-disk spelling of files/directories rather than spelling used to make the change. Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff Hostetler committed May 26, 2022 at 21:47 UTC caa9c37ec0b1c30ac1df266d01da6edb2c49d8ad
1 file changed +36
t/t7527-builtin-fsmonitor.sh
+36
@@ -832,4 +832,40 @@ test_expect_success 'submodule always visited' '
832 my_match_and_clean
833 '
834
835 +# On a case-insensitive file system, confirm that the daemon
836 +# notices when the .git directory is moved/renamed/deleted
837 +# regardless of how it is spelled in the the FS event.
838 +# That is, does the FS event receive the spelling of the
839 +# operation or does it receive the spelling preserved with
840 +# the file/directory.
841 +#
842 +test_expect_success CASE_INSENSITIVE_FS 'case insensitive+preserving' '
843 +# test_when_finished "stop_daemon_delete_repo test_insensitive" &&
844 +
845 + git init test_insensitive &&
846 +
847 + start_daemon -C test_insensitive --tf "$PWD/insensitive.trace" &&
848 +
849 + mkdir -p test_insensitive/abc/def &&
850 + echo xyz >test_insensitive/ABC/DEF/xyz &&
851 +
852 + test_path_is_dir test_insensitive/.git &&
853 + test_path_is_dir test_insensitive/.GIT &&
854 +
855 + # Rename .git using an alternate spelling to verify that that
856 + # daemon detects it and automatically shuts down.
857 + mv test_insensitive/.GIT test_insensitive/.FOO &&
858 + sleep 1 &&
859 + mv test_insensitive/.FOO test_insensitive/.git &&
860 + test_must_fail git -C test_insensitive fsmonitor--daemon status &&
861 +
862 + # Verify that events were reported using on-disk spellings of the
863 + # directories and files that we touched. We may or may not get a
864 + # trailing slash on modified directories.
865 + #
866 + egrep "^event: abc/?$" ./insensitive.trace &&
867 + egrep "^event: abc/def/?$" ./insensitive.trace &&
868 + egrep "^event: abc/def/xyz$" ./insensitive.trace
869 +'
870 +
871 test_done