@@ -153,6 +153,8 @@ test_expect_success 'setup' '
153
153
.gitignore
154
154
expect*
155
155
actual*
156
+ flush*
157
+ trace*
156
158
EOF
157
159
158
160
git -c core.useBuiltinFSMonitor= add . &&
@@ -472,4 +474,99 @@ test_expect_success 'worktree with .git file' '
472
474
test_must_fail git -C wt-secondary fsmonitor--daemon status
473
475
'
474
476
477
+ # TODO Repeat one of the "edit" tests on wt-secondary and confirm that
478
+ # TODO we get the same events and behavior -- that is, that fsmonitor--daemon
479
+ # TODO correctly listens to events on both the working directory and to the
480
+ # TODO referenced GITDIR.
481
+
482
+ test_expect_success ' cleanup worktrees' '
483
+ kill_repo wt-secondary &&
484
+ kill_repo wt-base
485
+ '
486
+
487
+ # The next few tests perform arbitrary/contrived file operations and
488
+ # confirm that status is correct. That is, that the data (or lack of
489
+ # data) from fsmonitor doesn't cause incorrect results. And doesn't
490
+ # cause incorrect results when the untracked-cache is enabled.
491
+
492
+ test_lazy_prereq UNTRACKED_CACHE '
493
+ { git update-index --test-untracked-cache; ret=$?; } &&
494
+ test $ret -ne 1
495
+ '
496
+
497
+ test_expect_success ' Matrix: setup for untracked-cache,fsmonitor matrix' '
498
+ test_might_fail git config --unset core.useBuiltinFSMonitor &&
499
+ git update-index --no-fsmonitor &&
500
+ test_might_fail git fsmonitor--daemon stop
501
+ '
502
+
503
+ matrix_clean_up_repo () {
504
+ git reset --hard HEAD
505
+ git clean -fd
506
+ }
507
+
508
+ matrix_try () {
509
+ uc=$1
510
+ fsm=$2
511
+ fn=$3
512
+
513
+ test_expect_success " Matrix[uc:$uc ][fsm:$fsm ] $fn " '
514
+ matrix_clean_up_repo &&
515
+ $fn &&
516
+ if test $uc = false -a $fsm = false
517
+ then
518
+ git status --porcelain=v1 >.git/expect.$fn
519
+ else
520
+ git status --porcelain=v1 >.git/actual.$fn
521
+ test_cmp .git/expect.$fn .git/actual.$fn
522
+ fi
523
+ '
524
+
525
+ return $?
526
+ }
527
+
528
+ uc_values=" false"
529
+ test_have_prereq UNTRACKED_CACHE && uc_values=" false true"
530
+ for uc_val in $uc_values
531
+ do
532
+ if test $uc_val = false
533
+ then
534
+ test_expect_success " Matrix[uc:$uc_val ] disable untracked cache" '
535
+ git config core.untrackedcache false &&
536
+ git update-index --no-untracked-cache
537
+ '
538
+ else
539
+ test_expect_success " Matrix[uc:$uc_val ] enable untracked cache" '
540
+ git config core.untrackedcache true &&
541
+ git update-index --untracked-cache
542
+ '
543
+ fi
544
+
545
+ fsm_values=" false true"
546
+ for fsm_val in $fsm_values
547
+ do
548
+ if test $fsm_val = false
549
+ then
550
+ test_expect_success " Matrix[uc:$uc_val ][fsm:$fsm_val ] disable fsmonitor" '
551
+ test_might_fail git config --unset core.useBuiltinFSMonitor &&
552
+ git update-index --no-fsmonitor &&
553
+ test_might_fail git fsmonitor--daemon stop 2>/dev/null
554
+ '
555
+ else
556
+ test_expect_success " Matrix[uc:$uc_val ][fsm:$fsm_val ] enable fsmonitor" '
557
+ git config core.useBuiltinFSMonitor true &&
558
+ git fsmonitor--daemon start &&
559
+ git update-index --fsmonitor
560
+ '
561
+ fi
562
+
563
+ matrix_try $uc_val $fsm_val edit_files
564
+ matrix_try $uc_val $fsm_val delete_files
565
+ matrix_try $uc_val $fsm_val create_files
566
+ matrix_try $uc_val $fsm_val rename_files
567
+ matrix_try $uc_val $fsm_val file_to_directory
568
+ matrix_try $uc_val $fsm_val directory_to_file
569
+ done
570
+ done
571
+
475
572
test_done
0 commit comments