{"thread":{"id":"42314","subject":"[PATCH v2] diff: run arguments through precompose_argv","startedAt":"2016-05-13T20:41:01Z","lastAt":"2016-05-14T05:53:53Z","messageCount":3,"participants":["Alexander Rinass","Torsten Bögershausen"],"isPatch":true,"patchVersion":2,"patchTotal":null},"messages":[{"id":"286498","messageId":"1463172062-4175-1-git-send-email-alex@fournova.com","threadId":"42314","inReplyTo":null,"subject":"[PATCH v2] diff: run arguments through precompose_argv","fromName":"Alexander Rinass","fromEmail":"alex@fournova.com","sentAt":"2016-05-13T20:41:01Z","receivedAt":"2016-05-13T20:41:01Z","isPatch":true,"sender":{"key":"alex@fournova.com","avatar":"https://avatars.githubusercontent.com/u/116053?v=4"},"body":"I have used Junios proposal/changes for the commit message as I \nliked it and it is probably more in line with the usual commit\nmessages of the git project. I hope this is ok.\n\nLet me know if you need me to do any more changes or what the\nnext steps are if the patch is ok.\n\nAlexander\n\nAlexander Rinass (1):\n  diff: run arguments through precompose_argv\n\n builtin/diff-files.c         |  1 +\n builtin/diff-index.c         |  1 +\n builtin/diff-tree.c          |  2 ++\n builtin/diff.c               |  1 +\n t/t3910-mac-os-precompose.sh | 42 ++++++++++++++++++++++++++++++++++++++++++\n 5 files changed, 47 insertions(+)\n\n-- \n2.8.2\n"},{"id":"286497","messageId":"1463172062-4175-2-git-send-email-alex@fournova.com","threadId":"42314","inReplyTo":"1463172062-4175-1-git-send-email-alex@fournova.com","subject":"[PATCH v2] diff: run arguments through precompose_argv","fromName":"Alexander Rinass","fromEmail":"alex@fournova.com","sentAt":"2016-05-13T20:41:02Z","receivedAt":"2016-05-13T20:41:02Z","isPatch":true,"sender":{"key":"alex@fournova.com","avatar":"https://avatars.githubusercontent.com/u/116053?v=4"},"body":"When running diff commands, a pathspec containing decomposed\nunicode code points is not converted to precomposed unicode form\nunder Mac OS X, but we normalize the paths in the index and the\nhistory to precomposed form on that platform.  As a result, the\npathspec would not match and no diff is shown.\n\nUnlike many builtin commands, the \"diff\" family of commands do\nnot use parse_options(), which is how other builtin commands\nindirectly call precompose_argv() to normalize argv[] into\nprecomposed form on Mac OSX.  Teach these commands to call\nprecompose_argv() themselves.\n\nNote that precomopose_argv() normalizes not just paths but all\ncommand line arguments, so things like \"git diff -G $string\"\nwhen $string has the decomposed form would first normalized into\nthe precomposed form and would stop hitting the same string in\nthe decomposed form in the diff output with this change.  It is\nnot a problem per-se, as \"log\" family of commands already use\nparse_options() and call precompose_argv()--we can think of it\nas making the \"diff\" family of commands behave in a similar way\nas the commands in the \"log\" family.\n\nSigned-off-by: Alexander Rinass <alex@fournova.com>\nHelped-by: Torsten Bögershausen <tboegi@web.de>\nHelped-by: Junio C Hamano <gitster@pobox.com>\n---\n builtin/diff-files.c         |  1 +\n builtin/diff-index.c         |  1 +\n builtin/diff-tree.c          |  2 ++\n builtin/diff.c               |  1 +\n t/t3910-mac-os-precompose.sh | 42 ++++++++++++++++++++++++++++++++++++++++++\n 5 files changed, 47 insertions(+)\n\ndiff --git a/builtin/diff-files.c b/builtin/diff-files.c\nindex 8ed2eb8..15c61fd 100644\n--- a/builtin/diff-files.c\n+++ b/builtin/diff-files.c\n@@ -24,6 +24,7 @@ int cmd_diff_files(int argc, const char **argv, const char *prefix)\n \tgitmodules_config();\n \tgit_config(git_diff_basic_config, NULL); /* no \"diff\" UI options */\n \trev.abbrev = 0;\n+\tprecompose_argv(argc, argv);\n \n \targc = setup_revisions(argc, argv, &rev, NULL);\n \twhile (1 < argc && argv[1][0] == '-') {\ndiff --git a/builtin/diff-index.c b/builtin/diff-index.c\nindex d979824..1af373d 100644\n--- a/builtin/diff-index.c\n+++ b/builtin/diff-index.c\n@@ -21,6 +21,7 @@ int cmd_diff_index(int argc, const char **argv, const char *prefix)\n \tgitmodules_config();\n \tgit_config(git_diff_basic_config, NULL); /* no \"diff\" UI options */\n \trev.abbrev = 0;\n+\tprecompose_argv(argc, argv);\n \n \targc = setup_revisions(argc, argv, &rev, NULL);\n \tfor (i = 1; i < argc; i++) {\ndiff --git a/builtin/diff-tree.c b/builtin/diff-tree.c\nindex 2a12b81..806dd7a 100644\n--- a/builtin/diff-tree.c\n+++ b/builtin/diff-tree.c\n@@ -114,6 +114,8 @@ int cmd_diff_tree(int argc, const char **argv, const char *prefix)\n \topt->disable_stdin = 1;\n \tmemset(&s_r_opt, 0, sizeof(s_r_opt));\n \ts_r_opt.tweak = diff_tree_tweak_rev;\n+\n+\tprecompose_argv(argc, argv);\n \targc = setup_revisions(argc, argv, opt, &s_r_opt);\n \n \twhile (--argc > 0) {\ndiff --git a/builtin/diff.c b/builtin/diff.c\nindex 52c98a9..d6b8f98 100644\n--- a/builtin/diff.c\n+++ b/builtin/diff.c\n@@ -319,6 +319,7 @@ int cmd_diff(int argc, const char **argv, const char *prefix)\n \tif (!no_index)\n \t\tgitmodules_config();\n \tgit_config(git_diff_ui_config, NULL);\n+\tprecompose_argv(argc, argv);\n \n \tinit_revisions(&rev, prefix);\n \ndiff --git a/t/t3910-mac-os-precompose.sh b/t/t3910-mac-os-precompose.sh\nindex 8319356..26dd5b7 100755\n--- a/t/t3910-mac-os-precompose.sh\n+++ b/t/t3910-mac-os-precompose.sh\n@@ -49,12 +49,54 @@ test_expect_success \"setup\" '\n test_expect_success \"setup case mac\" '\n \tgit checkout -b mac_os\n '\n+# This will test nfd2nfc in git diff\n+test_expect_success \"git diff f.Adiar\" '\n+\ttouch f.$Adiarnfc &&\n+\tgit add f.$Adiarnfc &&\n+\techo f.Adiarnfc >f.$Adiarnfc &&\n+\tgit diff f.$Adiarnfd >expect &&\n+\tgit diff f.$Adiarnfc >actual &&\n+\ttest_cmp expect actual &&\n+\tgit reset HEAD f.Adiarnfc &&\n+\trm f.$Adiarnfc expect actual\n+'\n+# This will test nfd2nfc in git diff-files\n+test_expect_success \"git diff-files f.Adiar\" '\n+\ttouch f.$Adiarnfc &&\n+\tgit add f.$Adiarnfc &&\n+\techo f.Adiarnfc >f.$Adiarnfc &&\n+\tgit diff-files f.$Adiarnfd >expect &&\n+\tgit diff-files f.$Adiarnfc >actual &&\n+\ttest_cmp expect actual &&\n+\tgit reset HEAD f.Adiarnfc &&\n+\trm f.$Adiarnfc expect actual\n+'\n+# This will test nfd2nfc in git diff-index\n+test_expect_success \"git diff-index f.Adiar\" '\n+\ttouch f.$Adiarnfc &&\n+\tgit add f.$Adiarnfc &&\n+\techo f.Adiarnfc >f.$Adiarnfc &&\n+\tgit diff-index HEAD f.$Adiarnfd >expect &&\n+\tgit diff-index HEAD f.$Adiarnfc >actual &&\n+\ttest_cmp expect actual &&\n+\tgit reset HEAD f.Adiarnfc &&\n+\trm f.$Adiarnfc expect actual\n+'\n # This will test nfd2nfc in readdir()\n test_expect_success \"add file Adiarnfc\" '\n \techo f.Adiarnfc >f.$Adiarnfc &&\n \tgit add f.$Adiarnfc &&\n \tgit commit -m \"add f.$Adiarnfc\"\n '\n+# This will test nfd2nfc in git diff-tree\n+test_expect_success \"git diff-tree f.Adiar\" '\n+\techo f.Adiarnfc >>f.$Adiarnfc &&\n+\tgit diff-tree HEAD f.$Adiarnfd >expect &&\n+\tgit diff-tree HEAD f.$Adiarnfc >actual &&\n+\ttest_cmp expect actual &&\n+\tgit checkout f.$Adiarnfc &&\n+\trm expect actual\n+'\n # This will test nfd2nfc in git stage()\n test_expect_success \"stage file d.Adiarnfd/f.Adiarnfd\" '\n \tmkdir d.$Adiarnfd &&\n-- \n2.8.2\n"},{"id":"286524","messageId":"bcbb1d5e-1f19-e5a9-2b52-d768d118f412@web.de","threadId":"42314","inReplyTo":"1463172062-4175-2-git-send-email-alex@fournova.com","subject":"Re: [PATCH v2] diff: run arguments through precompose_argv","fromName":"Torsten Bögershausen","fromEmail":"tboegi@web.de","sentAt":"2016-05-14T05:53:53Z","receivedAt":"2016-05-14T05:53:53Z","isPatch":true,"sender":{"key":"tboegi@web.de","avatar":"https://avatars.githubusercontent.com/u/7138363?v=4"},"body":"\n\nOn 13.05.16 22:41, Alexander Rinass wrote:\n> When running diff commands, a pathspec containing decomposed\n> unicode code points is not converted to precomposed unicode form\n> under Mac OS X, but we normalize the paths in the index and the\n> history to precomposed form on that platform.  As a result, the\n> pathspec would not match and no diff is shown.\n>\n> Unlike many builtin commands, the \"diff\" family of commands do\n> not use parse_options(), which is how other builtin commands\n> indirectly call precompose_argv() to normalize argv[] into\n> precomposed form on Mac OSX.  Teach these commands to call\n> precompose_argv() themselves.\n>\n> Note that precomopose_argv() normalizes not just paths but all\n> command line arguments, so things like \"git diff -G $string\"\n> when $string has the decomposed form would first normalized into\n> the precomposed form and would stop hitting the same string in\n> the decomposed form in the diff output with this change.  It is\n> not a problem per-se, as \"log\" family of commands already use\n> parse_options() and call precompose_argv()--we can think of it\n> as making the \"diff\" family of commands behave in a similar way\n> as the commands in the \"log\" family.\n>\n> Signed-off-by: Alexander Rinass <alex@fournova.com>\n> Helped-by: Torsten Bögershausen <tboegi@web.de>\n> Helped-by: Junio C Hamano <gitster@pobox.com>\nLooks good to me.\n"}]}