Web lists-archives.com

Re: [PATCH 02/14] clone, fetch-pack, index-pack, transport: partial clone




On Thu,  2 Nov 2017 20:31:17 +0000
Jeff Hostetler <git@xxxxxxxxxxxxxxxxx> wrote:

> From: Jeff Hostetler <jeffhost@xxxxxxxxxxxxx>
> 
> Signed-off-by: Jeff Hostetler <jeffhost@xxxxxxxxxxxxx>
> ---
>  builtin/clone.c      |  9 +++++++++
>  builtin/fetch-pack.c |  4 ++++
>  builtin/index-pack.c | 10 ++++++++++
>  fetch-pack.c         | 13 +++++++++++++
>  fetch-pack.h         |  2 ++
>  transport-helper.c   |  5 +++++
>  transport.c          |  4 ++++
>  transport.h          |  5 +++++
>  8 files changed, 52 insertions(+)

I managed to take a look at some of these patches. Firstly, consider
separating out the clone part, since it will not be tested until a few
patches later.

> diff --git a/builtin/index-pack.c b/builtin/index-pack.c
> index a0a35e6..31cd5ba 100644
> --- a/builtin/index-pack.c
> +++ b/builtin/index-pack.c
> @@ -222,6 +222,16 @@ static unsigned check_object(struct object *obj)
>  	if (!(obj->flags & FLAG_CHECKED)) {
>  		unsigned long size;
>  		int type = sha1_object_info(obj->oid.hash, &size);
> +
> +		if (type <= 0) {
> +			/*
> +			 * TODO Use the promisor code to conditionally
> +			 * try to fetch this object -or- assume it is ok.
> +			 */
> +			obj->flags |= FLAG_CHECKED;
> +			return 0;
> +		}
> +
>  		if (type <= 0)
>  			die(_("did not receive expected object %s"),
>  			      oid_to_hex(&obj->oid));

This causes some repo corruption tests to fail.

If I remove this and rebase the fetch-pack tests on top [1], the tests
pass, so this might not be necessary (for now, at least).

[1] https://github.com/jonathantanmy/git/commits/pc20171103