git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jonathan Nieder <jrnieder@gmail.com>
To: Jonathan Tan <jonathantanmy@google.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 1/2] connected: verify promisor-ness of partial clone
Date: Wed, 29 Jan 2020 12:41:52 -0800	[thread overview]
Message-ID: <20200129204152.GA17350@google.com> (raw)
In-Reply-To: <6a4f704e475fe1669e63731333fce9ed09d17d0c.1578802317.git.jonathantanmy@google.com>

Jonathan Tan wrote:

> Commit dfa33a298d ("clone: do faster object check for partial clones",
> 2019-04-21) optimized the connectivity check done when cloning with
> --filter to check only the existence of objects directly pointed to by
> refs. But this is not sufficient: they also need to be promisor objects.
> Make this check more robust by instead checking that these objects are
> promisor objects, that is, they appear in a promisor pack.
>
> Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
> ---
>  builtin/clone.c |  5 +++--
>  connected.c     | 19 ++++++++++++++-----
>  connected.h     | 11 ++++++-----
>  3 files changed, 23 insertions(+), 12 deletions(-)

Good call.  Sorry for the slow review.

[...]
> --- a/connected.c
> +++ b/connected.c
> @@ -52,19 +52,28 @@ int check_connected(oid_iterate_fn fn, void *cb_data,
>  		strbuf_release(&idx_file);
>  	}
>  
> -	if (opt->check_refs_only) {
> +	if (opt->check_refs_are_promisor_objects_only) {
>  		/*
>  		 * For partial clones, we don't want to have to do a regular
>  		 * connectivity check because we have to enumerate and exclude
>  		 * all promisor objects (slow), and then the connectivity check
>  		 * itself becomes a no-op because in a partial clone every
>  		 * object is a promisor object. Instead, just make sure we
> -		 * received the objects pointed to by each wanted ref.
> +		 * received, in a promisor packfile, the objects pointed to by
> +		 * each wanted ref.
>  		 */
>  		do {
> -			if (!repo_has_object_file_with_flags(the_repository, &oid,
> -							     OBJECT_INFO_SKIP_FETCH_OBJECT))
> -				return 1;
> +			struct packed_git *p;
> +
> +			for (p = get_all_packs(the_repository); p; p = p->next) {
> +				if (!p->pack_promisor)
> +					continue;
> +				if (find_pack_entry_one(oid.hash, p))
> +					goto promisor_pack_found;
> +			}
> +			return 1;
> +promisor_pack_found:
> +			;
>  		} while (!fn(cb_data, &oid));
>  		return 0;

Yep, does what it says on the tin.

Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>

  reply	other threads:[~2020-01-29 20:41 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-12  4:15 [PATCH 0/2] Skip a connectivity check during fetch --filter Jonathan Tan
2020-01-12  4:15 ` [PATCH 1/2] connected: verify promisor-ness of partial clone Jonathan Tan
2020-01-29 20:41   ` Jonathan Nieder [this message]
2020-01-12  4:15 ` [PATCH 2/2] fetch: forgo full connectivity check if --filter Jonathan Tan
2020-01-29 20:43   ` Jonathan Nieder
2020-01-30 18:57     ` Junio C Hamano

Reply instructions:

You may reply publicly 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 using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200129204152.GA17350@google.com \
    --to=jrnieder@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=jonathantanmy@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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).