{"thread":{"id":"34778","subject":"[PATCH/RFC v2] Set core.precomposeunicode to true on e.g. HFS+","startedAt":"2013-08-27T13:50:40Z","lastAt":"2013-08-27T14:33:16Z","messageCount":2,"participants":["Torsten Bögershausen","Junio C Hamano"],"isPatch":true,"patchVersion":2,"patchTotal":null},"messages":[{"id":"225991","messageId":"201308271550.41448.tboegi@web.de","threadId":"34778","inReplyTo":null,"subject":"[PATCH/RFC v2] Set core.precomposeunicode to true on e.g. HFS+","fromName":"Torsten Bögershausen","fromEmail":"tboegi@web.de","sentAt":"2013-08-27T13:50:40Z","receivedAt":"2013-08-27T13:50:40Z","isPatch":true,"sender":{"key":"tboegi@web.de","avatar":"https://avatars.githubusercontent.com/u/7138363?v=4"},"body":"When core.precomposeunicode was introduced in 76759c7d,\nit was set to false on a unicode decomposing file system like HFS+\nto be compatible with older versions of Git.\n\nThe Mac OS users need to find out that this configuration exist\nand change it manually from false to true.\n\nA smoother workflow can be achieved,\nso set core.precomposeunicode to true on a decomposing file system.\n\nSigned-off-by: Torsten Bögershausen <tboegi@web.de>\n---\n compat/precompose_utf8.c     | 7 ++-----\n t/t0050-filesystem.sh        | 1 +\n t/t3910-mac-os-precompose.sh | 2 +-\n t/t7400-submodule-basic.sh   | 1 -\n 4 files changed, 4 insertions(+), 7 deletions(-)\n\ndiff --git a/compat/precompose_utf8.c b/compat/precompose_utf8.c\nindex 7980abd..95fe849 100644\n--- a/compat/precompose_utf8.c\n+++ b/compat/precompose_utf8.c\n@@ -48,11 +48,8 @@ void probe_utf8_pathname_composition(char *path, int len)\n \tif (output_fd >= 0) {\n \t\tclose(output_fd);\n \t\tstrcpy(path + len, auml_nfd);\n-\t\t/* Indicate to the user, that we can configure it to true */\n-\t\tif (!access(path, R_OK))\n-\t\t\tgit_config_set(\"core.precomposeunicode\", \"false\");\n-\t\t/* To be backward compatible, set precomposed_unicode to 0 */\n-\t\tprecomposed_unicode = 0;\n+\t\tprecomposed_unicode = access(path, R_OK) ? 0 : 1;\n+\t\tgit_config_set(\"core.precomposeunicode\", precomposed_unicode ? \"true\" : \"false\");\n \t\tstrcpy(path + len, auml_nfc);\n \t\tif (unlink(path))\n \t\t\tdie_errno(_(\"failed to unlink '%s'\"), path);\ndiff --git a/t/t0050-filesystem.sh b/t/t0050-filesystem.sh\nindex 05d78d2..6b3cedc 100755\n--- a/t/t0050-filesystem.sh\n+++ b/t/t0050-filesystem.sh\n@@ -91,6 +91,7 @@ test_expect_failure CASE_INSENSITIVE_FS 'add (with different case)' '\n test_expect_success \"setup unicode normalization tests\" '\n \ttest_create_repo unicode &&\n \tcd unicode &&\n+\tgit config core.precomposeunicode false &&\n \ttouch \"$aumlcdiar\" &&\n \tgit add \"$aumlcdiar\" &&\n \tgit commit -m initial &&\ndiff --git a/t/t3910-mac-os-precompose.sh b/t/t3910-mac-os-precompose.sh\nindex 5fe57c5..e4ba601 100755\n--- a/t/t3910-mac-os-precompose.sh\n+++ b/t/t3910-mac-os-precompose.sh\n@@ -36,7 +36,7 @@ Alongc=$Alongc$AEligatu$AEligatu                     #254 Byte\n \n test_expect_success \"detect if nfd needed\" '\n \tprecomposeunicode=`git config core.precomposeunicode` &&\n-\ttest \"$precomposeunicode\" = false &&\n+\ttest \"$precomposeunicode\" = true &&\n \tgit config core.precomposeunicode true\n '\n test_expect_success \"setup\" '\ndiff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh\nindex 5ee97b0..f0f8cde 100755\n--- a/t/t7400-submodule-basic.sh\n+++ b/t/t7400-submodule-basic.sh\n@@ -958,7 +958,6 @@ test_expect_success 'submodule with UTF-8 name' '\n \t\tgit add sub &&\n \t\tgit commit -m \"init sub\"\n \t) &&\n-\ttest_config core.precomposeunicode true &&\n \tgit submodule add ./\"$svname\" &&\n \tgit submodule >&2 &&\n \ttest -n \"$(git submodule | grep \"$svname\")\"\n-- \n1.8.4.rc0.177.gceb3200\n"},{"id":"225994","messageId":"xmqqzjs3fbkj.fsf@gitster.dls.corp.google.com","threadId":"34778","inReplyTo":"201308271550.41448.tboegi@web.de","subject":"Re: [PATCH/RFC v2] Set core.precomposeunicode to true on e.g. HFS+","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-08-27T14:33:16Z","receivedAt":"2013-08-27T14:33:16Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Torsten Bögershausen <tboegi@web.de> writes:\n\n> When core.precomposeunicode was introduced in 76759c7d,\n> it was set to false on a unicode decomposing file system like HFS+\n> to be compatible with older versions of Git.\n>\n> The Mac OS users need to find out that this configuration exist\n> and change it manually from false to true.\n\nYeah, I think this makes sense.\n\nI actually wonder why we thought that the way 76759c7d (git on Mac\nOS and precomposed unicode, 2012-07-08) did \"add the variable to the\nconfig but do not enable\" was a good idea.  If I recall correctly,\nthe justification was \"that way the users will not be suddenly\naffected by the behaviour change, but can notice an unfamiliar\nvariable in their configuration and flip it as needed\"; I said that\nit did not make sense to me ($gmane/188940) back then and now I\nthink with this patch we are in agreement ;-).\n\n> -\t\t/* Indicate to the user, that we can configure it to true */\n> -\t\tif (!access(path, R_OK))\n> -\t\t\tgit_config_set(\"core.precomposeunicode\", \"false\");\n> -\t\t/* To be backward compatible, set precomposed_unicode to 0 */\n> -\t\tprecomposed_unicode = 0;\n> +\t\tprecomposed_unicode = access(path, R_OK) ? 0 : 1;\n> +\t\tgit_config_set(\"core.precomposeunicode\", precomposed_unicode ? \"true\" : \"false\");\n\nThis test is very conservative in that only a successful access()\nwill flip the bit; I like it.\n\nWill queue.  Thanks.\n\n>  \t\tstrcpy(path + len, auml_nfc);\n>  \t\tif (unlink(path))\n>  \t\t\tdie_errno(_(\"failed to unlink '%s'\"), path);\n> diff --git a/t/t0050-filesystem.sh b/t/t0050-filesystem.sh\n> index 05d78d2..6b3cedc 100755\n> --- a/t/t0050-filesystem.sh\n> +++ b/t/t0050-filesystem.sh\n> @@ -91,6 +91,7 @@ test_expect_failure CASE_INSENSITIVE_FS 'add (with different case)' '\n>  test_expect_success \"setup unicode normalization tests\" '\n>  \ttest_create_repo unicode &&\n>  \tcd unicode &&\n> +\tgit config core.precomposeunicode false &&\n>  \ttouch \"$aumlcdiar\" &&\n>  \tgit add \"$aumlcdiar\" &&\n>  \tgit commit -m initial &&\n> diff --git a/t/t3910-mac-os-precompose.sh b/t/t3910-mac-os-precompose.sh\n> index 5fe57c5..e4ba601 100755\n> --- a/t/t3910-mac-os-precompose.sh\n> +++ b/t/t3910-mac-os-precompose.sh\n> @@ -36,7 +36,7 @@ Alongc=$Alongc$AEligatu$AEligatu                     #254 Byte\n>  \n>  test_expect_success \"detect if nfd needed\" '\n>  \tprecomposeunicode=`git config core.precomposeunicode` &&\n> -\ttest \"$precomposeunicode\" = false &&\n> +\ttest \"$precomposeunicode\" = true &&\n>  \tgit config core.precomposeunicode true\n>  '\n>  test_expect_success \"setup\" '\n> diff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh\n> index 5ee97b0..f0f8cde 100755\n> --- a/t/t7400-submodule-basic.sh\n> +++ b/t/t7400-submodule-basic.sh\n> @@ -958,7 +958,6 @@ test_expect_success 'submodule with UTF-8 name' '\n>  \t\tgit add sub &&\n>  \t\tgit commit -m \"init sub\"\n>  \t) &&\n> -\ttest_config core.precomposeunicode true &&\n>  \tgit submodule add ./\"$svname\" &&\n>  \tgit submodule >&2 &&\n>  \ttest -n \"$(git submodule | grep \"$svname\")\"\n"}]}