git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] submodule: do no re-read name in shell script
@ 2016-07-21  0:51 Stefan Beller
  2016-07-21  1:00 ` Jonathan Nieder
  0 siblings, 1 reply; 3+ messages in thread
From: Stefan Beller @ 2016-07-21  0:51 UTC (permalink / raw)
  To: gitster; +Cc: git, Jens.Lehmann, jrnieder, Stefan Beller

Instead of making another call to a submodule helper (name), just
propagate the value when we know it (in the update-clone helper) already.

Signed-off-by: Stefan Beller <sbeller@google.com>
---
 builtin/submodule--helper.c | 4 ++--
 git-submodule.sh            | 3 +--
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c
index b22352b..494e088 100644
--- a/builtin/submodule--helper.c
+++ b/builtin/submodule--helper.c
@@ -683,9 +683,9 @@ static int prepare_to_clone_next_submodule(const struct cache_entry *ce,
 	needs_cloning = !file_exists(sb.buf);
 
 	strbuf_reset(&sb);
-	strbuf_addf(&sb, "%06o %s %d %d\t%s\n", ce->ce_mode,
+	strbuf_addf(&sb, "%06o %s %d %d %s\t%s\n", ce->ce_mode,
 			sha1_to_hex(ce->sha1), ce_stage(ce),
-			needs_cloning, ce->name);
+			needs_cloning, sub->name, sub->path);
 	string_list_append(&suc->projectlines, sb.buf);
 
 	if (!needs_cloning)
diff --git a/git-submodule.sh b/git-submodule.sh
index 4ec7546..e23aada 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -584,11 +584,10 @@ cmd_update()
 		"$@" || echo "#unmatched"
 	} | {
 	err=
-	while read mode sha1 stage just_cloned sm_path
+	while read mode sha1 stage just_cloned name sm_path
 	do
 		die_if_unmatched "$mode"
 
-		name=$(git submodule--helper name "$sm_path") || exit
 		url=$(git config submodule."$name".url)
 		branch=$(get_submodule_config "$name" branch master)
 		if ! test -z "$update"
-- 
2.9.2.369.g0e67330


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] submodule: do no re-read name in shell script
  2016-07-21  0:51 [PATCH] submodule: do no re-read name in shell script Stefan Beller
@ 2016-07-21  1:00 ` Jonathan Nieder
  2016-07-21  1:40   ` Stefan Beller
  0 siblings, 1 reply; 3+ messages in thread
From: Jonathan Nieder @ 2016-07-21  1:00 UTC (permalink / raw)
  To: Stefan Beller; +Cc: gitster, git, Jens.Lehmann

Stefan Beller wrote:

> Instead of making another call to a submodule helper (name), just
> propagate the value when we know it (in the update-clone helper) already.
>
> Signed-off-by: Stefan Beller <sbeller@google.com>
> ---
>  builtin/submodule--helper.c | 4 ++--
>  git-submodule.sh            | 3 +--
>  2 files changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c
> index b22352b..494e088 100644
> --- a/builtin/submodule--helper.c
> +++ b/builtin/submodule--helper.c
> @@ -683,9 +683,9 @@ static int prepare_to_clone_next_submodule(const struct cache_entry *ce,
>  	needs_cloning = !file_exists(sb.buf);
> 
>  	strbuf_reset(&sb);
> -	strbuf_addf(&sb, "%06o %s %d %d\t%s\n", ce->ce_mode,
> +	strbuf_addf(&sb, "%06o %s %d %d %s\t%s\n", ce->ce_mode,
>  			sha1_to_hex(ce->sha1), ce_stage(ce),
> -			needs_cloning, ce->name);
> +			needs_cloning, sub->name, sub->path);

Are there any restrictions on what characters a submodule name can
contain?  Does this need e.g. to be quoted with sq_quote?

Thanks,
Jonathan

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] submodule: do no re-read name in shell script
  2016-07-21  1:00 ` Jonathan Nieder
@ 2016-07-21  1:40   ` Stefan Beller
  0 siblings, 0 replies; 3+ messages in thread
From: Stefan Beller @ 2016-07-21  1:40 UTC (permalink / raw)
  To: Jonathan Nieder; +Cc: Junio C Hamano, git@vger.kernel.org, Jens Lehmann

On Wed, Jul 20, 2016 at 6:00 PM, Jonathan Nieder <jrnieder@gmail.com> wrote:

>> -                     needs_cloning, ce->name);
>> +                     needs_cloning, sub->name, sub->path);
>
> Are there any restrictions on what characters a submodule name can
> contain?  Does this need e.g. to be quoted with sq_quote?

Oh good point, this ought to fail with weird names. So instead of quoting it,
let's just drop this patch.

>
> Thanks,
> Jonathan

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-07-21  1:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-21  0:51 [PATCH] submodule: do no re-read name in shell script Stefan Beller
2016-07-21  1:00 ` Jonathan Nieder
2016-07-21  1:40   ` Stefan Beller

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).