{"thread":{"id":"34133","subject":"[PATCH v2 0/2] module_list enhancements","startedAt":"2013-06-14T00:26:01Z","lastAt":"2013-06-14T15:02:04Z","messageCount":4,"participants":["Fredrik Gustafsson","Junio C Hamano"],"isPatch":true,"patchVersion":2,"patchTotal":2},"messages":[{"id":"220779","messageId":"1371169563-10267-1-git-send-email-iveqy@iveqy.com","threadId":"34133","inReplyTo":null,"subject":"[PATCH v2 0/2] module_list enhancements","fromName":"Fredrik Gustafsson","fromEmail":"iveqy@iveqy.com","sentAt":"2013-06-14T00:26:01Z","receivedAt":"2013-06-14T00:26:01Z","isPatch":true,"sender":{"key":"iveqy@iveqy.com","avatar":"https://avatars.githubusercontent.com/u/761743?v=4"},"body":"The first iteration can be found here:\nhttp://thread.gmane.org/gmane.comp.version-control.git/227572/\n\nThe errors in the first patch was a faulty test. I also applied Junios solution in the\nfirst patch, it was nicer.\n\nFredrik Gustafsson (2):\n  [submodule] handle multibyte characters in name\n  [submodule] Replace perl-code with sh\n\n git-submodule.sh           | 53 ++++++++++++++++++++--------------------------\n t/t7400-submodule-basic.sh | 12 +++++++++++\n 2 files changed, 35 insertions(+), 30 deletions(-)\n\n-- \n1.8.3.1.381.g2ab719e.dirty\n"},{"id":"220781","messageId":"1371169563-10267-2-git-send-email-iveqy@iveqy.com","threadId":"34133","inReplyTo":"1371169563-10267-1-git-send-email-iveqy@iveqy.com","subject":"[PATCH v2 1/2] [submodule] handle multibyte characters in name","fromName":"Fredrik Gustafsson","fromEmail":"iveqy@iveqy.com","sentAt":"2013-06-14T00:26:02Z","receivedAt":"2013-06-14T00:26:02Z","isPatch":true,"sender":{"key":"iveqy@iveqy.com","avatar":"https://avatars.githubusercontent.com/u/761743?v=4"},"body":"Many \"git submodule\" operations do not work on a submodule at a path whose\nname is not in ASCII.\n\nThis is because \"git ls-files\" is used to find which paths are bound to\nsubmodules to the current working tree, and the output is C-quoted by default\nfor non ASCII pathnames.\n\nTell \"git ls-files\" to not C-quote its output, which is easier than unwrapping\nC-quote ourselves.\n\nSolution-suggested-by: Junio C Hamano <gitster@pobox.com>\nSigned-off-by: Fredrik Gustafsson <iveqy@iveqy.com>\n---\n git-submodule.sh           |  2 +-\n t/t7400-submodule-basic.sh | 12 ++++++++++++\n 2 files changed, 13 insertions(+), 1 deletion(-)\n\ndiff --git a/git-submodule.sh b/git-submodule.sh\nindex 79bfaac..bad051e 100755\n--- a/git-submodule.sh\n+++ b/git-submodule.sh\n@@ -113,7 +113,7 @@ resolve_relative_url ()\n module_list()\n {\n \t(\n-\t\tgit ls-files --error-unmatch --stage -- \"$@\" ||\n+\t\tgit -c core.quotepath=false ls-files --error-unmatch --stage -- \"$@\" ||\n \t\techo \"unmatched pathspec exists\"\n \t) |\n \tperl -e '\ndiff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh\nindex ff26535..d5743ee 100755\n--- a/t/t7400-submodule-basic.sh\n+++ b/t/t7400-submodule-basic.sh\n@@ -868,4 +868,16 @@ test_expect_success 'submodule deinit fails when submodule has a .git directory\n \ttest -n \"$(git config --get-regexp \"submodule\\.example\\.\")\"\n '\n \n+test_expect_success 'submodule with strange name works \"å äö\"' '\n+\tmkdir \"å äö\" &&\n+\t(\n+\t\tcd \"å äö\" &&\n+\t\tgit init &&\n+\t\ttouch sub\n+\t\tgit add sub\n+\t\tgit commit -m \"init sub\"\n+\t)\n+\tgit submodule add \"/å äö\" &&\n+\ttest -n \"$(git submodule | grep \"å äö\")\"\n+'\n test_done\n-- \n1.8.3.1.381.g2ab719e.dirty\n"},{"id":"220780","messageId":"1371169563-10267-3-git-send-email-iveqy@iveqy.com","threadId":"34133","inReplyTo":"1371169563-10267-1-git-send-email-iveqy@iveqy.com","subject":"[PATCH v2 2/2] [submodule] Replace perl-code with sh","fromName":"Fredrik Gustafsson","fromEmail":"iveqy@iveqy.com","sentAt":"2013-06-14T00:26:03Z","receivedAt":"2013-06-14T00:26:03Z","isPatch":true,"sender":{"key":"iveqy@iveqy.com","avatar":"https://avatars.githubusercontent.com/u/761743?v=4"},"body":"This will prevent a fork and makes the code similair to the rest of the\nfile.\n\nIn the long term git-submodule.sh needs to use something else than sh to\nhandle newline in filenames (and therefore needs to use a language that\naccepts \\0 in strings). However I don't think that keeping that small\nperl-part will ease any rewrite.\n\nSigned-off-by: Fredrik Gustafsson <iveqy@iveqy.com>\n---\n git-submodule.sh | 51 ++++++++++++++++++++++-----------------------------\n 1 file changed, 22 insertions(+), 29 deletions(-)\n\ndiff --git a/git-submodule.sh b/git-submodule.sh\nindex bad051e..be96934 100755\n--- a/git-submodule.sh\n+++ b/git-submodule.sh\n@@ -112,38 +112,31 @@ resolve_relative_url ()\n #\n module_list()\n {\n+\tnull_sha1=0000000000000000000000000000000000000000\n+\tunmerged=\n \t(\n \t\tgit -c core.quotepath=false ls-files --error-unmatch --stage -- \"$@\" ||\n-\t\techo \"unmatched pathspec exists\"\n+\t\techo \"#unmatched\"\n \t) |\n-\tperl -e '\n-\tmy %unmerged = ();\n-\tmy ($null_sha1) = (\"0\" x 40);\n-\tmy @out = ();\n-\tmy $unmatched = 0;\n-\twhile (<STDIN>) {\n-\t\tif (/^unmatched pathspec/) {\n-\t\t\t$unmatched = 1;\n-\t\t\tnext;\n-\t\t}\n-\t\tchomp;\n-\t\tmy ($mode, $sha1, $stage, $path) =\n-\t\t\t/^([0-7]+) ([0-9a-f]{40}) ([0-3])\\t(.*)$/;\n-\t\tnext unless $mode eq \"160000\";\n-\t\tif ($stage ne \"0\") {\n-\t\t\tif (!$unmerged{$path}++) {\n-\t\t\t\tpush @out, \"$mode $null_sha1 U\\t$path\\n\";\n-\t\t\t}\n-\t\t\tnext;\n-\t\t}\n-\t\tpush @out, \"$_\\n\";\n-\t}\n-\tif ($unmatched) {\n-\t\tprint \"#unmatched\\n\";\n-\t} else {\n-\t\tprint for (@out);\n-\t}\n-\t'\n+\twhile read mode sha1 stage path\n+\tdo\n+\t\tif test $mode = \"#unmatched\"\n+\t\tthen\n+\t\t\techo \"#unmatched\"\n+\t\telif test $mode = \"160000\"\n+\t\tthen\n+\t\t\tif test $stage != \"0\"\n+\t\t\tthen\n+\t\t\t\tif test \"$unmerged\" != \"$path\"\n+\t\t\t\tthen\n+\t\t\t\t\techo \"$mode $null_sha1 U $path\"\n+\t\t\t\tfi\n+\t\t\t\tunmerged=\"$path\"\n+\t\t\telse\n+\t\t\t\techo \"$mode $sha1 $stage $path\"\n+\t\t\tfi\n+\t\tfi\n+\tdone\n }\n \n die_if_unmatched ()\n-- \n1.8.3.1.381.g2ab719e.dirty\n"},{"id":"220870","messageId":"7vppvorb0z.fsf@alter.siamese.dyndns.org","threadId":"34133","inReplyTo":"1371169563-10267-2-git-send-email-iveqy@iveqy.com","subject":"Re: [PATCH v2 1/2] [submodule] handle multibyte characters in name","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-06-14T15:02:04Z","receivedAt":"2013-06-14T15:02:04Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Fredrik Gustafsson <iveqy@iveqy.com> writes:\n\n> Many \"git submodule\" operations do not work on a submodule at a path whose\n> name is not in ASCII.\n\nThanks.  A suggestion to add some more explanation to the log\nmessage follows.\n\n> This is because \"git ls-files\" is used to find which paths are bound to\n> submodules to the current working tree, and the output is C-quoted by default\n> for non ASCII pathnames.\n\nAnd pathnames that has a double-quote, a backslash, or a control\ncharacter like a newline or a tab in them.\n\n> Tell \"git ls-files\" to not C-quote its output, which is easier than unwrapping\n> C-quote ourselves.\n\nThis patch still does not allow pathnames with characters that do\nneed C-quote, but the code didn't handle them before, so it is not\nmaking things worse.\n\nThe correct approach to solve the problem for all pathnames may be\nto use \"ls-files -z\" and tell the Perl script that reads its output\nto read NUL separated records by using $/ = \"\\0\".\n\n> Solution-suggested-by: Junio C Hamano <gitster@pobox.com>\n> Signed-off-by: Fredrik Gustafsson <iveqy@iveqy.com>\n> ---\n>  git-submodule.sh           |  2 +-\n>  t/t7400-submodule-basic.sh | 12 ++++++++++++\n>  2 files changed, 13 insertions(+), 1 deletion(-)\n>\n> diff --git a/git-submodule.sh b/git-submodule.sh\n> index 79bfaac..bad051e 100755\n> --- a/git-submodule.sh\n> +++ b/git-submodule.sh\n> @@ -113,7 +113,7 @@ resolve_relative_url ()\n>  module_list()\n>  {\n>  \t(\n> -\t\tgit ls-files --error-unmatch --stage -- \"$@\" ||\n> +\t\tgit -c core.quotepath=false ls-files --error-unmatch --stage -- \"$@\" ||\n>  \t\techo \"unmatched pathspec exists\"\n>  \t) |\n>  \tperl -e '\n> diff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh\n> index ff26535..d5743ee 100755\n> --- a/t/t7400-submodule-basic.sh\n> +++ b/t/t7400-submodule-basic.sh\n> @@ -868,4 +868,16 @@ test_expect_success 'submodule deinit fails when submodule has a .git directory\n>  \ttest -n \"$(git config --get-regexp \"submodule\\.example\\.\")\"\n>  '\n>  \n> +test_expect_success 'submodule with strange name works \"å äö\"' '\n> +\tmkdir \"å äö\" &&\n> +\t(\n> +\t\tcd \"å äö\" &&\n> +\t\tgit init &&\n> +\t\ttouch sub\n> +\t\tgit add sub\n> +\t\tgit commit -m \"init sub\"\n> +\t)\n> +\tgit submodule add \"/å äö\" &&\n> +\ttest -n \"$(git submodule | grep \"å äö\")\"\n> +'\n>  test_done\n"}]}