Skip to content

Commit a1014b0

Browse files
jeffhostetlerGit for Windows Build Agent
authored andcommitted
t7527: test Unicode NFC/NFD handling on MacOS
Confirm that the daemon reports events using the on-disk spelling for Unicode NFC/NFD characters. On APFS we still have Unicode aliasing, so we cannot create two files that only differ by NFC/NFD, but the on-disk format preserves the spelling used to create the file. On HFS+ we also have aliasing, but the path is always stored on disk in NFD. Signed-off-by: Jeff Hostetler <[email protected]>
1 parent e1bfb77 commit a1014b0

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed

t/t7527-builtin-fsmonitor.sh

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -850,4 +850,59 @@ test_expect_success CASE_INSENSITIVE_FS 'case insensitive+preserving' '
850850
egrep "^event: abc/def/xyz$" ./insensitive.trace
851851
'
852852

853+
# The variable "unicode_debug" is defined in the following library
854+
# script to dump information about how the (OS, FS) handles Unicode
855+
# composition. Uncomment the following line if you want to enable it.
856+
#
857+
# unicode_debug=true
858+
859+
. "$TEST_DIRECTORY/lib-unicode-nfc-nfd.sh"
860+
861+
# See if the OS or filesystem does NFC/NFD aliasing/munging.
862+
#
863+
# The daemon should err on the side of caution and send BOTH the
864+
# NFC and NFD forms. It does not know the original spelling of
865+
# the pathname (how the user thinks it should be spelled), so
866+
# emit both and let the client decide (when necessary). This is
867+
# similar to "core.precomposeUnicode".
868+
#
869+
test_expect_success !UNICODE_COMPOSITION_SENSITIVE 'Unicode nfc/nfd' '
870+
test_when_finished "stop_daemon_delete_repo test_unicode" &&
871+
872+
git init test_unicode &&
873+
874+
start_daemon -C test_unicode --tf "$PWD/unicode.trace" &&
875+
876+
# Create a directory using an NFC spelling.
877+
#
878+
mkdir test_unicode/nfc &&
879+
mkdir test_unicode/nfc/c_${utf8_nfc} &&
880+
881+
# Create a directory using an NFD spelling.
882+
#
883+
mkdir test_unicode/nfd &&
884+
mkdir test_unicode/nfd/d_${utf8_nfd} &&
885+
886+
git -C test_unicode fsmonitor--daemon stop &&
887+
888+
if test_have_prereq UNICODE_NFC_PRESERVED
889+
then
890+
# We should have seen NFC event from OS.
891+
# We should not have synthesized an NFD event.
892+
egrep "^event: nfc/c_${utf8_nfc}/?$" ./unicode.trace &&
893+
egrep -v "^event: nfc/c_${utf8_nfd}/?$" ./unicode.trace
894+
else
895+
# We should have seen NFD event from OS.
896+
# We should have synthesized an NFC event.
897+
egrep "^event: nfc/c_${utf8_nfd}/?$" ./unicode.trace &&
898+
egrep "^event: nfc/c_${utf8_nfc}/?$" ./unicode.trace
899+
fi &&
900+
901+
# We assume UNICODE_NFD_PRESERVED.
902+
# We should have seen explicit NFD from OS.
903+
# We should have synthesized an NFC event.
904+
egrep "^event: nfd/d_${utf8_nfd}/?$" ./unicode.trace &&
905+
egrep "^event: nfd/d_${utf8_nfc}/?$" ./unicode.trace
906+
'
907+
853908
test_done

0 commit comments

Comments
 (0)