@@ -162,6 +162,8 @@ test_expect_success 'setup' '
162
162
.gitignore
163
163
expect*
164
164
actual*
165
+ flush*
166
+ trace*
165
167
EOF
166
168
167
169
git -c core.useBuiltinFSMonitor= add . &&
@@ -508,4 +510,98 @@ test_expect_success 'cleanup worktrees' '
508
510
stop_daemon_delete_repo wt-base
509
511
'
510
512
513
+ # The next few tests perform arbitrary/contrived file operations and
514
+ # confirm that status is correct. That is, that the data (or lack of
515
+ # data) from fsmonitor doesn't cause incorrect results. And doesn't
516
+ # cause incorrect results when the untracked-cache is enabled.
517
+
518
+ test_lazy_prereq UNTRACKED_CACHE '
519
+ { git update-index --test-untracked-cache; ret=$?; } &&
520
+ test $ret -ne 1
521
+ '
522
+
523
+ test_expect_success ' Matrix: setup for untracked-cache,fsmonitor matrix' '
524
+ test_might_fail git config --unset core.useBuiltinFSMonitor &&
525
+ git update-index --no-fsmonitor &&
526
+ test_might_fail git fsmonitor--daemon stop
527
+ '
528
+
529
+ matrix_clean_up_repo () {
530
+ git reset --hard HEAD
531
+ git clean -fd
532
+ }
533
+
534
+ matrix_try () {
535
+ uc=$1
536
+ fsm=$2
537
+ fn=$3
538
+
539
+ test_expect_success " Matrix[uc:$uc ][fsm:$fsm ] $fn " '
540
+ matrix_clean_up_repo &&
541
+ $fn &&
542
+ if test $uc = false -a $fsm = false
543
+ then
544
+ git status --porcelain=v1 >.git/expect.$fn
545
+ else
546
+ git status --porcelain=v1 >.git/actual.$fn
547
+ test_cmp .git/expect.$fn .git/actual.$fn
548
+ fi
549
+ '
550
+
551
+ return $?
552
+ }
553
+
554
+ uc_values=" false"
555
+ test_have_prereq UNTRACKED_CACHE && uc_values=" false true"
556
+ for uc_val in $uc_values
557
+ do
558
+ if test $uc_val = false
559
+ then
560
+ test_expect_success " Matrix[uc:$uc_val ] disable untracked cache" '
561
+ git config core.untrackedcache false &&
562
+ git update-index --no-untracked-cache
563
+ '
564
+ else
565
+ test_expect_success " Matrix[uc:$uc_val ] enable untracked cache" '
566
+ git config core.untrackedcache true &&
567
+ git update-index --untracked-cache
568
+ '
569
+ fi
570
+
571
+ fsm_values=" false true"
572
+ for fsm_val in $fsm_values
573
+ do
574
+ if test $fsm_val = false
575
+ then
576
+ test_expect_success " Matrix[uc:$uc_val ][fsm:$fsm_val ] disable fsmonitor" '
577
+ test_might_fail git config --unset core.useBuiltinFSMonitor &&
578
+ git update-index --no-fsmonitor &&
579
+ test_might_fail git fsmonitor--daemon stop 2>/dev/null
580
+ '
581
+ else
582
+ test_expect_success " Matrix[uc:$uc_val ][fsm:$fsm_val ] enable fsmonitor" '
583
+ git config core.useBuiltinFSMonitor true &&
584
+ git fsmonitor--daemon start &&
585
+ git update-index --fsmonitor
586
+ '
587
+ fi
588
+
589
+ matrix_try $uc_val $fsm_val edit_files
590
+ matrix_try $uc_val $fsm_val delete_files
591
+ matrix_try $uc_val $fsm_val create_files
592
+ matrix_try $uc_val $fsm_val rename_files
593
+ matrix_try $uc_val $fsm_val file_to_directory
594
+ matrix_try $uc_val $fsm_val directory_to_file
595
+
596
+ if test $fsm_val = true
597
+ then
598
+ test_expect_success " Matrix[uc:$uc_val ][fsm:$fsm_val ] disable fsmonitor at end" '
599
+ test_might_fail git config --unset core.useBuiltinFSMonitor &&
600
+ git update-index --no-fsmonitor &&
601
+ test_might_fail git fsmonitor--daemon stop 2>/dev/null
602
+ '
603
+ fi
604
+ done
605
+ done
606
+
511
607
test_done
0 commit comments