Skip to content

Commit f7fb6e2

Browse files
committed
Merge branch 'nd/fbsd-lazy-mtime' into maint
FreeBSD can lie when asked mtime of a directory, which made the untracked cache code to fall back to a slow-path, which in turn caused tests in t7063 to fail because it wanted to verify the behaviour of the fast-path. * nd/fbsd-lazy-mtime: t7063: work around FreeBSD's lazy mtime update feature
2 parents 1dc4aa6 + 6b7728d commit f7fb6e2

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

t/t7063-status-untracked-cache.sh

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,20 @@ test_description='test untracked cache'
44

55
. ./test-lib.sh
66

7+
# On some filesystems (e.g. FreeBSD's ext2 and ufs) directory mtime
8+
# is updated lazily after contents in the directory changes, which
9+
# forces the untracked cache code to take the slow path. A test
10+
# that wants to make sure that the fast path works correctly should
11+
# call this helper to make mtime of the containing directory in sync
12+
# with the reality before checking the fast path behaviour.
13+
#
14+
# See <[email protected]> if you want to know
15+
# more.
16+
17+
sync_mtime () {
18+
find . -type d -ls >/dev/null
19+
}
20+
721
avoid_racy() {
822
sleep 1
923
}
@@ -416,7 +430,8 @@ test_expect_success 'create/modify files, some of which are gitignored' '
416430
echo four >done/four && # four is gitignored at a higher level
417431
echo five >done/five && # five is not gitignored
418432
echo test >base && #we need to ensure that the root dir is touched
419-
rm base
433+
rm base &&
434+
sync_mtime
420435
'
421436

422437
test_expect_success 'test sparse status with untracked cache' '

0 commit comments

Comments
 (0)