{"thread":{"id":"34113","subject":"[PATCH 0/2] module_list enhancements","startedAt":"2013-06-11T23:04:12Z","lastAt":"2013-06-13T01:41:11Z","messageCount":9,"participants":["Fredrik Gustafsson","Junio C Hamano","Jens Lehmann","Phil Hord"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"220568","messageId":"1370991854-1414-1-git-send-email-iveqy@iveqy.com","threadId":"34113","inReplyTo":null,"subject":"[PATCH 0/2] module_list enhancements","fromName":"Fredrik Gustafsson","fromEmail":"iveqy@iveqy.com","sentAt":"2013-06-11T23:04:12Z","receivedAt":"2013-06-11T23:04:12Z","isPatch":true,"sender":{"key":"iveqy@iveqy.com","avatar":"https://avatars.githubusercontent.com/u/761743?v=4"},"body":"Cleanup and enhanced module_list (see patches for details). All new functionality is\nin the first patch, the second one deals only with cleanup. I would prefer if both\ngot applied.\n\nFredrik Gustafsson (2):\n  [submodule] handle multibyte characters in name\n  [submodule] Replace perl-code with sh\n\n git-submodule.sh           | 55 +++++++++++++++++++++-------------------------\n t/t7400-submodule-basic.sh |  5 +++++\n 2 files changed, 30 insertions(+), 30 deletions(-)\n\n-- \n1.8.3.253.g20b40b5.dirty\n"},{"id":"220569","messageId":"1370991854-1414-2-git-send-email-iveqy@iveqy.com","threadId":"34113","inReplyTo":"1370991854-1414-1-git-send-email-iveqy@iveqy.com","subject":"[PATCH 1/2] [submodule] handle multibyte characters in name","fromName":"Fredrik Gustafsson","fromEmail":"iveqy@iveqy.com","sentAt":"2013-06-11T23:04:13Z","receivedAt":"2013-06-11T23:04:13Z","isPatch":true,"sender":{"key":"iveqy@iveqy.com","avatar":"https://avatars.githubusercontent.com/u/761743?v=4"},"body":"Bugg reported here:\nhttp://thread.gmane.org/gmane.comp.version-control.git/218922/focus=226791\n\nNote that newline (\\n) is still not supported and will not be until the\nsh-script is replaced by something in an other language. This however\nlet us to use mostly all other strange characters.\n\nSigned-off-by: Fredrik Gustafsson <iveqy@iveqy.com>\n---\n git-submodule.sh           | 3 ++-\n t/t7400-submodule-basic.sh | 5 +++++\n 2 files changed, 7 insertions(+), 1 deletion(-)\n\ndiff --git a/git-submodule.sh b/git-submodule.sh\nindex 79bfaac..31524d3 100755\n--- a/git-submodule.sh\n+++ b/git-submodule.sh\n@@ -113,9 +113,10 @@ resolve_relative_url ()\n module_list()\n {\n \t(\n-\t\tgit ls-files --error-unmatch --stage -- \"$@\" ||\n+\t\tgit ls-files --error-unmatch --stage -z -- \"$@\" ||\n \t\techo \"unmatched pathspec exists\"\n \t) |\n+\tsed -e 's/\\x00/\\n/g' |\n \tperl -e '\n \tmy %unmerged = ();\n \tmy ($null_sha1) = (\"0\" x 40);\ndiff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh\nindex ff26535..47ab7e7 100755\n--- a/t/t7400-submodule-basic.sh\n+++ b/t/t7400-submodule-basic.sh\n@@ -868,4 +868,9 @@ 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+\tgit init \"å äö\" &&\n+\tgit submodule add \"./å äö\" &&\n+\ttest -n \"$(cat .gitmodules | grep \"å äö\")\"\n+'\n test_done\n-- \n1.8.3.253.g20b40b5.dirty\n"},{"id":"220570","messageId":"1370991854-1414-3-git-send-email-iveqy@iveqy.com","threadId":"34113","inReplyTo":"1370991854-1414-1-git-send-email-iveqy@iveqy.com","subject":"[PATCH 2/2] [submodule] Replace perl-code with sh","fromName":"Fredrik Gustafsson","fromEmail":"iveqy@iveqy.com","sentAt":"2013-06-11T23:04:14Z","receivedAt":"2013-06-11T23:04:14Z","isPatch":true,"sender":{"key":"iveqy@iveqy.com","avatar":"https://avatars.githubusercontent.com/u/761743?v=4"},"body":"This is a work built on\nhttp://thread.gmane.org/gmane.comp.version-control.git/198873/focus=198930\n\nBasically git-submodule.sh needs to use something else than sh to handle\nnewline in filenames (and therefore needs to use a language that accepts\n\\0 in strings).\n\nHowever, since we're not there yet. I've thrown out the only\nperl-dependency for git-submodule.sh. It decreases the number of\nlines of code and uses the same solution as the rest of the script\nalready do.\n\nThis would lead to less forks and faster code. A simple testrun of\nt7400-submodule-basic.sh before this patch resulted in:\nreal    0m8.359s\nuser    0m8.921s\nsys     0m3.888s\n\nreal    0m9.062s\nuser    0m9.025s\nsys     0m3.784s\n\nreal    0m8.490s\nuser    0m9.065s\nsys     0m3.740s\n\nAfter this patch was applied:\nreal    0m7.417s\nuser    0m8.717s\nsys     0m3.804s\n\nreal    0m7.873s\nuser    0m8.821s\nsys     0m3.692s\n\nreal    0m8.950s\nuser    0m8.765s\nsys     0m3.760s\n\nSigned-off-by: Fredrik Gustafsson <iveqy@iveqy.com>\n---\n git-submodule.sh | 52 +++++++++++++++++++++++-----------------------------\n 1 file changed, 23 insertions(+), 29 deletions(-)\n\ndiff --git a/git-submodule.sh b/git-submodule.sh\nindex 31524d3..1652781 100755\n--- a/git-submodule.sh\n+++ b/git-submodule.sh\n@@ -112,39 +112,33 @@ resolve_relative_url ()\n #\n module_list()\n {\n+\tnull_sha1=0000000000000000000000000000000000000000\n+\tunmerged=\n \t(\n \t\tgit ls-files --error-unmatch --stage -z -- \"$@\" ||\n-\t\techo \"unmatched pathspec exists\"\n+\t\techo \"#unmatched\"\n \t) |\n \tsed -e 's/\\x00/\\n/g' |\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\tfi\n+\t\tif 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.253.g20b40b5.dirty\n"},{"id":"220673","messageId":"7vppvr11kg.fsf_-_@alter.siamese.dyndns.org","threadId":"34113","inReplyTo":"1370991854-1414-2-git-send-email-iveqy@iveqy.com","subject":"Re: [PATCH 1/2] submodule: handle multibyte characters in name","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-06-12T21:06:23Z","receivedAt":"2013-06-12T21:06:23Z","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> Bugg reported here:\n> http://thread.gmane.org/gmane.comp.version-control.git/218922/focus=226791\n\nThe URL is nice supplemental info as footnote, but please write log\nmessage in a way that a reader can understand without going there.\nIn this case, it wouldn't be so hard, I think, perhaps like:\n\n\tMany \"git submodule\" operations do not work on a submodule\n\tat a path whose name is not in ASCII.\n\n\tThis is because \"git ls-files\" is used to find which paths\n\tare bound to submodules to the current working tree, and the\n\toutput is C-quoted by default for non ASCII pathnames.\n\n\tRead from \"git ls-files -z\" instead, which is easier than\n\tunwrapping C-quote ourselves.\n\nor something.\n\n>  module_list()\n>  {\n>  \t(\n> -\t\tgit ls-files --error-unmatch --stage -- \"$@\" ||\n> +\t\tgit ls-files --error-unmatch --stage -z -- \"$@\" ||\n>  \t\techo \"unmatched pathspec exists\"\n>  \t) |\n> +\tsed -e 's/\\x00/\\n/g' |\n\nIt is strange to preprosess input to be read by a Perl script with\nsed ;-)\n\nHow about doing it this way instead?  Does the result pass your\ntest?\n\n git-submodule.sh | 3 ++-\n 1 file changed, 2 insertions(+), 1 deletion(-)\n\ndiff --git a/git-submodule.sh b/git-submodule.sh\nindex 79bfaac..19faf58 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 ls-files --error-unmatch --stage -z -- \"$@\" ||\n \t\techo \"unmatched pathspec exists\"\n \t) |\n \tperl -e '\n@@ -121,6 +121,7 @@ module_list()\n \tmy ($null_sha1) = (\"0\" x 40);\n \tmy @out = ();\n \tmy $unmatched = 0;\n+\t$/ = \"\\0\";\n \twhile (<STDIN>) {\n \t\tif (/^unmatched pathspec/) {\n \t\t\t$unmatched = 1;\n"},{"id":"220674","messageId":"7vli6f11gk.fsf@alter.siamese.dyndns.org","threadId":"34113","inReplyTo":"1370991854-1414-3-git-send-email-iveqy@iveqy.com","subject":"Re: [PATCH 2/2] [submodule] Replace perl-code with sh","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-06-12T21:08:43Z","receivedAt":"2013-06-12T21:08:43Z","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> This is a work built on\n> http://thread.gmane.org/gmane.comp.version-control.git/198873/focus=198930\n>\n> Basically git-submodule.sh needs to use something else than sh to handle\n> newline in filenames (and therefore needs to use a language that accepts\n> \\0 in strings).\n\nHave you considered \"git -c core.quotepath=false ls-files\"?  You\nwon't be able to handle paths with LF or dq '\"' in them, but that\nfeels much less worse than doing\n\n\tsed -e 's/\\x00/\\n/'\n"},{"id":"220678","messageId":"51B8EA67.7040801@web.de","threadId":"34113","inReplyTo":"7vppvr11kg.fsf_-_@alter.siamese.dyndns.org","subject":"Re: [PATCH 1/2] submodule: handle multibyte characters in name","fromName":"Jens Lehmann","fromEmail":"jens.lehmann@web.de","sentAt":"2013-06-12T21:38:47Z","receivedAt":"2013-06-12T21:38:47Z","isPatch":true,"sender":{"key":"jens.lehmann@web.de","avatar":"https://avatars.githubusercontent.com/u/135220?v=4"},"body":"Am 12.06.2013 23:06, schrieb Junio C Hamano:\n> Fredrik Gustafsson <iveqy@iveqy.com> writes:\n> \n>> Bugg reported here:\n>> http://thread.gmane.org/gmane.comp.version-control.git/218922/focus=226791\n> \n> The URL is nice supplemental info as footnote, but please write log\n> message in a way that a reader can understand without going there.\n> In this case, it wouldn't be so hard, I think, perhaps like:\n> \n> \tMany \"git submodule\" operations do not work on a submodule\n> \tat a path whose name is not in ASCII.\n> \n> \tThis is because \"git ls-files\" is used to find which paths\n> \tare bound to submodules to the current working tree, and the\n> \toutput is C-quoted by default for non ASCII pathnames.\n> \n> \tRead from \"git ls-files -z\" instead, which is easier than\n> \tunwrapping C-quote ourselves.\n> \n> or something.\n> \n>>  module_list()\n>>  {\n>>  \t(\n>> -\t\tgit ls-files --error-unmatch --stage -- \"$@\" ||\n>> +\t\tgit ls-files --error-unmatch --stage -z -- \"$@\" ||\n>>  \t\techo \"unmatched pathspec exists\"\n>>  \t) |\n>> +\tsed -e 's/\\x00/\\n/g' |\n> \n> It is strange to preprosess input to be read by a Perl script with\n> sed ;-)\n> \n> How about doing it this way instead?  Does the result pass your\n> test?\n\nHmm, I just came around to test that patch, and for me the new\ntest even succeeds without the changes to module_list(). So I'm\nnot convinced yet what we are fixing here ;-)\n\nThe original poster reported that the submodule just added locally\nis not showing up in a subsequent `git submodule`. And it doesn't\nfor me either, no matter if the path contains umlauts or not. Will\ntake a deeper look when I find some more time to do that, maybe\nrecent changes to \"git add\" play a role here too.\n\n>  git-submodule.sh | 3 ++-\n>  1 file changed, 2 insertions(+), 1 deletion(-)\n> \n> diff --git a/git-submodule.sh b/git-submodule.sh\n> index 79bfaac..19faf58 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 ls-files --error-unmatch --stage -z -- \"$@\" ||\n>  \t\techo \"unmatched pathspec exists\"\n>  \t) |\n>  \tperl -e '\n> @@ -121,6 +121,7 @@ module_list()\n>  \tmy ($null_sha1) = (\"0\" x 40);\n>  \tmy @out = ();\n>  \tmy $unmatched = 0;\n> +\t$/ = \"\\0\";\n>  \twhile (<STDIN>) {\n>  \t\tif (/^unmatched pathspec/) {\n>  \t\t\t$unmatched = 1;\n> \n"},{"id":"220684","messageId":"7vk3lzym1b.fsf@alter.siamese.dyndns.org","threadId":"34113","inReplyTo":"51B8EA67.7040801@web.de","subject":"Re: [PATCH 1/2] submodule: handle multibyte characters in name","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-06-12T22:57:52Z","receivedAt":"2013-06-12T22:57:52Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jens Lehmann <Jens.Lehmann@web.de> writes:\n\n> Hmm, I just came around to test that patch, and for me the new\n> test even succeeds without the changes to module_list(). So I'm\n> not convinced yet what we are fixing here ;-)\n\nMy guess is that you have core.quotepaths set to false.\n\n> The original poster reported that the submodule just added locally\n> is not showing up in a subsequent `git submodule`. And it doesn't\n> for me either, no matter if the path contains umlauts or not. Will\n> take a deeper look when I find some more time to do that, maybe\n> recent changes to \"git add\" play a role here too.\n\nThanks.\n"},{"id":"220685","messageId":"20130612231035.GA18022@paksenarrion.iveqy.com","threadId":"34113","inReplyTo":"7vk3lzym1b.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH 1/2] submodule: handle multibyte characters in name","fromName":"Fredrik Gustafsson","fromEmail":"iveqy@iveqy.com","sentAt":"2013-06-12T23:10:35Z","receivedAt":"2013-06-12T23:10:35Z","isPatch":true,"sender":{"key":"iveqy@iveqy.com","avatar":"https://avatars.githubusercontent.com/u/761743?v=4"},"body":"On Wed, Jun 12, 2013 at 03:57:52PM -0700, Junio C Hamano wrote:\n> Jens Lehmann <Jens.Lehmann@web.de> writes:\n> \n> > Hmm, I just came around to test that patch, and for me the new\n> > test even succeeds without the changes to module_list(). So I'm\n> > not convinced yet what we are fixing here ;-)\n> \n> My guess is that you have core.quotepaths set to false.\n\nActually the bug-reporter claimed to see the submodule in .gitmodules\nbut not when listed with git submodule.\n\nThe test is missing one line in the end to check for this. Sorry about\nthat.\n\nI've a new iteration ready for this but want to test it a bit more\nlocally so I don't miss anything else first.\n\n-- \nMed vänliga hälsningar\nFredrik Gustafsson\n\ntel: 0733-608274\ne-post: iveqy@iveqy.com\n"},{"id":"220687","messageId":"CABURp0psXnq9XFux1X9W11jdc7JJZU=87pFHMSfuigYz58Exqw@mail.gmail.com","threadId":"34113","inReplyTo":"1370991854-1414-2-git-send-email-iveqy@iveqy.com","subject":"Re: [PATCH 1/2] [submodule] handle multibyte characters in name","fromName":"Phil Hord","fromEmail":"phil.hord@gmail.com","sentAt":"2013-06-13T01:41:11Z","receivedAt":"2013-06-13T01:41:11Z","isPatch":true,"sender":{"key":"phil.hord@gmail.com","avatar":"https://avatars.githubusercontent.com/u/123908?v=4"},"body":"On Tue, Jun 11, 2013 at 7:04 PM, Fredrik Gustafsson <iveqy@iveqy.com> wrote:\n> Bugg reported here:\n> http://thread.gmane.org/gmane.comp.version-control.git/218922/focus=226791\n>\n> Note that newline (\\n) is still not supported and will not be until the\n> sh-script is replaced by something in an other language. This however\n> let us to use mostly all other strange characters.\n\nPlease explain the commit better so the reader can understand what the\ncommit does and why.  I can see what's going on by reading the commit\nand the original thread, but I should not have to.\n\nThanks,\nPhil\n"}]}