summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2018-01-21 14:00:50 +0000
committerEdward Thomson <ethomson@edwardthomson.com>2018-01-21 14:37:05 +0000
commit9af7fbc37d8a99cc58e9d890106644ad5c3ccdc7 (patch)
treecf3e13911a42de514eb2030300ed48c07c50381f
parent45f584090818c59ba27ca95b1e930a41c424d6f1 (diff)
downloadlibgit2-ethomson/apfs_precompose_fixes.tar.gz
status::renames: write NFD instead of NFC filenameethomson/apfs_precompose_fixes
Update the status::renames test to create an NFD format filename in the core.precomposedunicode tests. Previously, we would create an NFC format filename. This was to take advantage of HFS+ filesystems, which always use canonically decomposed formats, and would actually write the filename to disk as an NFD filename. So previously, we could create an NFC filename, but read it normally as an NFD filename. But APFS formats do not force canonically decomposed formats for filenames, so creating an NFC filename does not get converted to NFD. Instead, the filename will be written in NFC format. Our test, therefore, does not work - when we write an NFC filename, it will _remain_ NFC. Update the test to write NFD always. This will ensure that the file will actually be canonically decomposed on all platforms: HFS+, which forces NFD, and APFS, which does not. Thus, our test will continue to ensure that an NFD filename is canonically precomposed on all filesystems.
-rw-r--r--tests/status/renames.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/tests/status/renames.c b/tests/status/renames.c
index f482d693a..ae32d2ee0 100644
--- a/tests/status/renames.c
+++ b/tests/status/renames.c
@@ -590,6 +590,12 @@ static char *nfc = "\xC3\x85\x73\x74\x72\xC3\xB6\x6D";
static char *nfd = "\x41\xCC\x8A\x73\x74\x72\x6F\xCC\x88\x6D";
#endif
+/*
+ * Create a file in NFD (canonically decomposed) format. Ensure
+ * that when core.precomposeunicode is false that we return paths
+ * in NFD, but when core.precomposeunicode is true, then we
+ * return paths precomposed (in NFC).
+ */
void test_status_renames__precomposed_unicode_rename(void)
{
#ifdef GIT_USE_ICONV
@@ -610,7 +616,7 @@ void test_status_renames__precomposed_unicode_rename(void)
{ GIT_STATUS_WT_RENAMED, "sixserving.txt", nfc },
};
- rename_file(g_repo, "sixserving.txt", nfc);
+ rename_file(g_repo, "sixserving.txt", nfd);
opts.flags |= GIT_STATUS_OPT_INCLUDE_UNTRACKED;