{"thread":{"id":"42893","subject":"[PATCH] submodule: do no re-read name in shell script","startedAt":"2016-07-21T00:51:38Z","lastAt":"2016-07-21T01:40:58Z","messageCount":3,"participants":["Stefan Beller","Jonathan Nieder"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"291896","messageId":"20160721005122.15966-1-sbeller@google.com","threadId":"42893","inReplyTo":null,"subject":"[PATCH] submodule: do no re-read name in shell script","fromName":"Stefan Beller","fromEmail":"sbeller@google.com","sentAt":"2016-07-21T00:51:22Z","receivedAt":"2016-07-21T00:51:38Z","isPatch":true,"sender":{"key":"stefanbeller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/455868?v=4"},"body":"Instead of making another call to a submodule helper (name), just\npropagate the value when we know it (in the update-clone helper) already.\n\nSigned-off-by: Stefan Beller <sbeller@google.com>\n---\n builtin/submodule--helper.c | 4 ++--\n git-submodule.sh            | 3 +--\n 2 files changed, 3 insertions(+), 4 deletions(-)\n\ndiff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c\nindex b22352b..494e088 100644\n--- a/builtin/submodule--helper.c\n+++ b/builtin/submodule--helper.c\n@@ -683,9 +683,9 @@ static int prepare_to_clone_next_submodule(const struct cache_entry *ce,\n \tneeds_cloning = !file_exists(sb.buf);\n \n \tstrbuf_reset(&sb);\n-\tstrbuf_addf(&sb, \"%06o %s %d %d\\t%s\\n\", ce->ce_mode,\n+\tstrbuf_addf(&sb, \"%06o %s %d %d %s\\t%s\\n\", ce->ce_mode,\n \t\t\tsha1_to_hex(ce->sha1), ce_stage(ce),\n-\t\t\tneeds_cloning, ce->name);\n+\t\t\tneeds_cloning, sub->name, sub->path);\n \tstring_list_append(&suc->projectlines, sb.buf);\n \n \tif (!needs_cloning)\ndiff --git a/git-submodule.sh b/git-submodule.sh\nindex 4ec7546..e23aada 100755\n--- a/git-submodule.sh\n+++ b/git-submodule.sh\n@@ -584,11 +584,10 @@ cmd_update()\n \t\t\"$@\" || echo \"#unmatched\"\n \t} | {\n \terr=\n-\twhile read mode sha1 stage just_cloned sm_path\n+\twhile read mode sha1 stage just_cloned name sm_path\n \tdo\n \t\tdie_if_unmatched \"$mode\"\n \n-\t\tname=$(git submodule--helper name \"$sm_path\") || exit\n \t\turl=$(git config submodule.\"$name\".url)\n \t\tbranch=$(get_submodule_config \"$name\" branch master)\n \t\tif ! test -z \"$update\"\n-- \n2.9.2.369.g0e67330\n\n"},{"id":"291899","messageId":"20160721010029.GG29326@google.com","threadId":"42893","inReplyTo":"20160721005122.15966-1-sbeller@google.com","subject":"Re: [PATCH] submodule: do no re-read name in shell script","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2016-07-21T01:00:29Z","receivedAt":"2016-07-21T01:01:03Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Stefan Beller wrote:\n\n> Instead of making another call to a submodule helper (name), just\n> propagate the value when we know it (in the update-clone helper) already.\n>\n> Signed-off-by: Stefan Beller <sbeller@google.com>\n> ---\n>  builtin/submodule--helper.c | 4 ++--\n>  git-submodule.sh            | 3 +--\n>  2 files changed, 3 insertions(+), 4 deletions(-)\n>\n> diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c\n> index b22352b..494e088 100644\n> --- a/builtin/submodule--helper.c\n> +++ b/builtin/submodule--helper.c\n> @@ -683,9 +683,9 @@ static int prepare_to_clone_next_submodule(const struct cache_entry *ce,\n>  \tneeds_cloning = !file_exists(sb.buf);\n> \n>  \tstrbuf_reset(&sb);\n> -\tstrbuf_addf(&sb, \"%06o %s %d %d\\t%s\\n\", ce->ce_mode,\n> +\tstrbuf_addf(&sb, \"%06o %s %d %d %s\\t%s\\n\", ce->ce_mode,\n>  \t\t\tsha1_to_hex(ce->sha1), ce_stage(ce),\n> -\t\t\tneeds_cloning, ce->name);\n> +\t\t\tneeds_cloning, sub->name, sub->path);\n\nAre there any restrictions on what characters a submodule name can\ncontain?  Does this need e.g. to be quoted with sq_quote?\n\nThanks,\nJonathan\n"},{"id":"291903","messageId":"CAGZ79kYZphh7f6tf0a7=6gKf+=Vg1zO5MdCNypZ0vC8d3Fh7=A@mail.gmail.com","threadId":"42893","inReplyTo":"20160721010029.GG29326@google.com","subject":"Re: [PATCH] submodule: do no re-read name in shell script","fromName":"Stefan Beller","fromEmail":"sbeller@google.com","sentAt":"2016-07-21T01:40:53Z","receivedAt":"2016-07-21T01:40:58Z","isPatch":true,"sender":{"key":"stefanbeller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/455868?v=4"},"body":"On Wed, Jul 20, 2016 at 6:00 PM, Jonathan Nieder <jrnieder@gmail.com> wrote:\n\n>> -                     needs_cloning, ce->name);\n>> +                     needs_cloning, sub->name, sub->path);\n>\n> Are there any restrictions on what characters a submodule name can\n> contain?  Does this need e.g. to be quoted with sq_quote?\n\nOh good point, this ought to fail with weird names. So instead of quoting it,\nlet's just drop this patch.\n\n>\n> Thanks,\n> Jonathan\n"}]}