Skip to content

Commit b6367c7

Browse files
jeffhostetlerdscho
authored andcommitted
t7527: test status with untracked-cache and fsmonitor--daemon
Create 2x2 test matrix with the untracked-cache and fsmonitor--daemon features and a series of edits and verify that status output is identical. Signed-off-by: Jeff Hostetler <[email protected]>
1 parent 67f2c1d commit b6367c7

File tree

1 file changed

+87
-0
lines changed

1 file changed

+87
-0
lines changed

t/t7527-builtin-fsmonitor.sh

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,8 @@ test_expect_success 'setup' '
162162
.gitignore
163163
expect*
164164
actual*
165+
flush*
166+
trace*
165167
EOF
166168
167169
git -c core.useBuiltinFSMonitor= add . &&
@@ -508,4 +510,89 @@ test_expect_success 'cleanup worktrees' '
508510
stop_daemon_delete_repo wt-base
509511
'
510512

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+
done
596+
done
597+
511598
test_done

0 commit comments

Comments
 (0)