Set core.precomposeunicode to true on e.g. HFS+
PATCH v2 1/1 Set core.precomposeunicode to true on e.g. HFS+
When core.precomposeunicode was introduced in 76759c7d, it was set to false on a unicode decomposing file system like HFS+ to be compatible with older versions of Git.
The Mac OS users need to find out that this configuration exist and change it manually from false to true.
A smoother workflow can be achieved,
so set core.precomposeunicode to true on a decomposing file system.
--- compat/precompose_utf8.c | 7 ++----- t/t0050-filesystem.sh | 1 + t/t3910-mac-os-precompose.sh | 2 +- t/t7400-submodule-basic.sh | 1 - 4 files changed, 4 insertions(+), 7 deletions(-)
compat/precompose_utf8.c +2 -5
@@ -48,11 +48,8 @@ void probe_utf8_pathname_composition(char *path, int len)if (output_fd >=0 ) {close (output_fd);strcpy (path + len, auml_nfd); -/* Indicate to the user, that we can configure it to true */ -if (!access (path,R_OK )) -git_config_set ("core.precomposeunicode" ,"false" ); -/* To be backward compatible, set precomposed_unicode to 0 */ - precomposed_unicode =0 ; + precomposed_unicode =access (path,R_OK ) ?0 :1 ; +git_config_set ("core.precomposeunicode" , precomposed_unicode ?"true" :"false" );strcpy (path + len, auml_nfc);if (unlink (path))die_errno (_ ("failed to unlink '%s'" ), path);
t/t0050-filesystem.sh +1 -0
@@ -91,6 +91,7 @@ test_expect_failure CASE_INSENSITIVE_FS 'add (with different case)' ' test_expect_success "setup unicode normalization tests" ' test_create_repo unicode && cd unicode && + git config core.precomposeunicode false && touch "$aumlcdiar" && git add "$aumlcdiar" && git commit -m initial &&
t/t3910-mac-os-precompose.sh +1 -1
@@ -36,7 +36,7 @@ Alongc=$Alongc$AEligatu$AEligatu #254 Byte test_expect_success "detect if nfd needed" ' precomposeunicode=`git config core.precomposeunicode` && - test "$precomposeunicode" = false && + test "$precomposeunicode" = true && git config core.precomposeunicode true ' test_expect_success "setup" '
t/t7400-submodule-basic.sh +0 -1
@@ -958,7 +958,6 @@ test_expect_success 'submodule with UTF-8 name' ' git add sub && git commit -m "init sub" ) && - test_config core.precomposeunicode true && git submodule add ./"$svname" && git submodule >&2 && test -n "$(git submodule | grep "$svname")"
Signature · 1 line
1.8.4.rc0.177.gceb3200
Quoted 6 lines · Torsten Bögershausen
When core.precomposeunicode was introduced in
76759c7d, it was set to false on a unicode decomposing file system like HFS+ to be compatible with older versions of Git.The Mac OS users need to find out that this configuration exist and change it manually from false to true.
Yeah, I think this makes sense.
I actually wonder why we thought that the way 76759c7d (git on Mac OS and precomposed unicode, 2012-07-08) did "add the variable to the config but do not enable" was a good idea. If I recall correctly, the justification was "that way the users will not be suddenly affected by the behaviour change, but can notice an unfamiliar variable in their configuration and flip it as needed"; I said that it did not make sense to me ($gmane/188940) back then and now I think with this patch we are in agreement ;-).
compat/precompose_utf8.c void probe_utf8_pathname_composition(char *path, int len) · line 52
Quoted 7 lines
compat/precompose_utf8.c +2
-5-/* Indicate to the user, that we can configure it to true */ -if (!access (path,R_OK )) -git_config_set ("core.precomposeunicode" ,"false" ); -/* To be backward compatible, set precomposed_unicode to 0 */ - precomposed_unicode =0 ; + precomposed_unicode =access (path,R_OK ) ?0 :1 ; +git_config_set ("core.precomposeunicode" , precomposed_unicode ?"true" :"false" );
This test is very conservative in that only a successful access() will flip the bit; I like it.
Will queue. Thanks.
Quoted 40 lines
compat/precompose_utf8.c +0
-0strcpy (path + len, auml_nfc);if (unlink (path))die_errno (_ ("failed to unlink '%s'" ), path);t/t0050-filesystem.sh +1
-0@@ -91,6 +91,7 @@ test_expect_failure CASE_INSENSITIVE_FS 'add (with different case)' ' test_expect_success "setup unicode normalization tests" ' test_create_repo unicode && cd unicode && + git config core.precomposeunicode false && touch "$aumlcdiar" && git add "$aumlcdiar" && git commit -m initial &&t/t3910-mac-os-precompose.sh +1
-1@@ -36,7 +36,7 @@ Alongc=$Alongc$AEligatu$AEligatu #254 Byte test_expect_success "detect if nfd needed" ' precomposeunicode=`git config core.precomposeunicode` && - test "$precomposeunicode" = false && + test "$precomposeunicode" = true && git config core.precomposeunicode true ' test_expect_success "setup" 't/t7400-submodule-basic.sh +0
-1@@ -958,7 +958,6 @@ test_expect_success 'submodule with UTF-8 name' ' git add sub && git commit -m "init sub" ) && - test_config core.precomposeunicode true && git submodule add ./"$svname" && git submodule >&2 && test -n "$(git submodule | grep "$svname")"