Skip to content

Commit 15b74bd

Browse files
jeffhostetlerGit for Windows Build Agent
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 7c3a6cc commit 15b74bd

File tree

1 file changed

+97
-0
lines changed

1 file changed

+97
-0
lines changed

t/t7527-builtin-fsmonitor.sh

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,8 @@ test_expect_success 'setup' '
163163
.gitignore
164164
expect*
165165
actual*
166+
flush*
167+
trace*
166168
EOF
167169
168170
git -c core.useBuiltinFSMonitor= add . &&
@@ -482,4 +484,99 @@ test_expect_success 'worktree with .git file' '
482484
test_must_fail git -C wt-secondary fsmonitor--daemon --is-running
483485
'
484486

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

0 commit comments

Comments
 (0)