git@vger.kernel.org mailing list mirror (one of many)
 help / Atom feed
From: Jonathan Nieder <jrnieder@gmail.com>
To: Stefan Beller <sbeller@google.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] submodule: use cheaper check for submodule pushes
Date: Wed, 12 Jul 2017 17:01:17 -0700
Message-ID: <20170713000117.GJ93855@aiede.mtv.corp.google.com> (raw)
In-Reply-To: <20170712234504.15811-1-sbeller@google.com>

Hi,

Stefan Beller wrote:

> In the function push_submodule[1] we use add_submodule_odb[2] to determine
> if a submodule has been populated. However the function does not work with
> the submodules objects that are added, instead a new child process is used
> to perform the actual push in the submodule.
>
> Use is_submodule_populated[3] that is cheaper to guard from unpopulated
> submodules.
>
> [1] 'push_submodule' was added in eb21c732d6 (push: teach
>     --recurse-submodules the on-demand option, 2012-03-29)
> [2] 'add_submodule_odb' was introduced in 752c0c2492 (Add the
>     --submodule option to the diff option family, 2009-10-19)
> [3] 'is_submodule_populated' was added in 5688c28d81 (submodules:
>     add helper to determine if a submodule is populated, 2016-12-16)

These footnotes don't answer the question that I really have: why did
this use add_submodule_odb in the first place?

E.g. did the ref iteration code require access to the object store
previously and stop requiring it later?

> Signed-off-by: Stefan Beller <sbeller@google.com>
> ---
>  submodule.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/submodule.c b/submodule.c
> index da2b484879..55afad3e8c 100644
> --- a/submodule.c
> +++ b/submodule.c
> @@ -976,7 +976,9 @@ static int push_submodule(const char *path,
>  			  const struct string_list *push_options,
>  			  int dry_run)
>  {
> -	if (add_submodule_odb(path))
> +	int code;
> +
> +	if (!is_submodule_populated_gently(path, &code))

Should this examine the code to distinguish between hard errors
(e.g. "Error reading .git") and a missing repository?

Thanks,
Jonathan

  reply index

Thread overview: 9+ messages in thread (expand / mbox.gz / Atom feed / [top])
2017-07-12 23:45 Stefan Beller
2017-07-13  0:01 ` Jonathan Nieder [this message]
2017-07-13  0:09   ` Stefan Beller
2017-07-13  0:53   ` Junio C Hamano
2017-07-13  5:14     ` Stefan Beller
2017-07-13 18:37       ` Junio C Hamano
2017-07-13 19:39         ` Stefan Beller
2017-07-13 20:48           ` Jonathan Nieder
2017-07-13 20:54             ` Stefan Beller

Reply instructions:

You may reply publically to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply to all the recipients using the --to, --cc,
  and --in-reply-to switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170713000117.GJ93855@aiede.mtv.corp.google.com \
    --to=jrnieder@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=sbeller@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

git@vger.kernel.org mailing list mirror (one of many)

Archives are clonable:
	git clone --mirror https://public-inbox.org/git
	git clone --mirror http://ou63pmih66umazou.onion/git
	git clone --mirror http://czquwvybam4bgbro.onion/git
	git clone --mirror http://hjrcffqmbrq6wope.onion/git

Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.version-control.git
	nntp://ou63pmih66umazou.onion/inbox.comp.version-control.git
	nntp://czquwvybam4bgbro.onion/inbox.comp.version-control.git
	nntp://hjrcffqmbrq6wope.onion/inbox.comp.version-control.git
	nntp://news.gmane.org/gmane.comp.version-control.git

 note: .onion URLs require Tor: https://www.torproject.org/
       or Tor2web: https://www.tor2web.org/

AGPL code for this site: git clone https://public-inbox.org/ public-inbox