Skip to content

Commit 67a44fb

Browse files
committed
t7527: test FS event reporing on MacOS WRT case and Unicode
Confirm that MacOS FS events are reported with a normalized spelling. APFS (and/or HFS+) is case-insensitive. This means that case-independent lookups ( [ -d .git ] and [ -d .GIT ] ) should both succeed. But that doesn't tell us how FS events are reported if we try "rm -rf .git" versus "rm -rf .GIT". Are the events reported using the on-disk spelling of the pathname or in the spelling used by the command. NEEDSWORK: I was only able to test case. It would be nice to add tests that use different Unicode spellings/normalizations and understand the differences between APFS and HFS+ in this area. We should confirm that the spelling of the workdir paths that the daemon sends to clients are always properly normalized. Signed-off-by: Jeff Hostetler <[email protected]>
1 parent 4005824 commit 67a44fb

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

t/t7527-builtin-fsmonitor.sh

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,36 @@ test_expect_success MINGW,SHORTNAMES 'implicit daemon stop (rename GIT~2)' '
188188
test_must_fail git -C test_implicit_1s2 fsmonitor--daemon status
189189
'
190190

191+
# Confirm that MacOS hides all of the Unicode normalization and/or
192+
# case folding from the FS events. That is, are the pathnames in the
193+
# FS events reported using the spelling on the disk or in the spelling
194+
# used by the other process.
195+
#
196+
# Note that we assume that the filesystem is set to case insensitive.
197+
#
198+
# NEEDSWORK: APFS handles Unicode and Unicode normalization
199+
# differently than HFS+. I only have an APFS partition, so
200+
# more testing here would be helpful.
201+
#
202+
203+
# Rename .git using alternate spelling and confirm that the daemon
204+
# sees the event using the correct spelling and shutdown.
205+
test_expect_success UTF8_NFD_TO_NFC 'MacOS event spelling (rename .GIT)' '
206+
test_when_finished "stop_daemon_delete_repo test_apfs" &&
207+
208+
git init test_apfs &&
209+
start_daemon test_apfs &&
210+
211+
test_path_is_dir test_apfs/.git &&
212+
test_path_is_dir test_apfs/.GIT &&
213+
214+
mv test_apfs/.GIT test_apfs/.FOO &&
215+
sleep 1 &&
216+
mv test_apfs/.FOO test_apfs/.git &&
217+
218+
test_must_fail git -C test_apfs fsmonitor--daemon status
219+
'
220+
191221
test_expect_success 'cannot start multiple daemons' '
192222
test_when_finished "stop_daemon_delete_repo test_multiple" &&
193223

0 commit comments

Comments
 (0)