t7527: FSMonitor tests for directory moves

Create unit tests to move a directory. Verify that `git status` gives the same result with and without FSMonitor enabled. 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 b5337082b34dbdb25f27014518841a6f78d82bf6
1 file changed +27
t/t7527-builtin-fsmonitor.sh
+27
@@ -274,6 +274,16 @@ test_expect_success 'setup' '
274 trace*
275 EOF
276
277 + mkdir -p T1/T2/T3/T4 &&
278 + echo 1 >T1/F1 &&
279 + echo 1 >T1/T2/F1 &&
280 + echo 1 >T1/T2/T3/F1 &&
281 + echo 1 >T1/T2/T3/T4/F1 &&
282 + echo 2 >T1/F2 &&
283 + echo 2 >T1/T2/F2 &&
284 + echo 2 >T1/T2/T3/F2 &&
285 + echo 2 >T1/T2/T3/T4/F2 &&
286 +
287 git -c core.fsmonitor=false add . &&
288 test_tick &&
289 git -c core.fsmonitor=false commit -m initial &&
@@ -356,6 +366,19 @@ directory_to_file () {
366 echo 1 >dir1
367 }
368
369 +move_directory_contents_deeper() {
370 + mkdir T1/_new_ &&
371 + mv T1/[A-Z]* T1/_new_
372 +}
373 +
374 +move_directory_up() {
375 + mv T1/T2/T3 T1
376 +}
377 +
378 +move_directory() {
379 + mv T1/T2/T3 T1/T2/NewT3
380 +}
381 +
382 # The next few test cases confirm that our fsmonitor daemon sees each type
383 # of OS filesystem notification that we care about. At this layer we just
384 # ensure we are getting the OS notifications and do not try to confirm what
@@ -660,6 +683,10 @@ do
683 matrix_try $uc_val $fsm_val file_to_directory
684 matrix_try $uc_val $fsm_val directory_to_file
685
686 + matrix_try $uc_val $fsm_val move_directory_contents_deeper
687 + matrix_try $uc_val $fsm_val move_directory_up
688 + matrix_try $uc_val $fsm_val move_directory
689 +
690 if test $fsm_val = true
691 then
692 test_expect_success "Matrix[uc:$uc_val][fsm:$fsm_val] disable fsmonitor at end" '