Subject: Re: [PATCH v2 4/5] fetch: teach independent negotiation (no packfile)

From: Junio C Hamano <[email-masked]>
Date: Wed, 05 May 2021 10:53:40 +0900

Jonathan Tan <[email-masked]> writes:

> +static int add_to_object_array(const struct object_id *oid, void *data)
> +{
> +	struct object_array *a = data;
> +
> +	add_object_array(lookup_object(the_repository, oid), "", a);

Moving to lookup_object() made me look around, but at this point the
object in question (which comes from the negotiation_tips) has been
instantiated, so it is OK.

    Side note. The big difference between lookup and parse is what
    happens when this process hasn't seen the object yet---the
    former will just return NULL instead of instantiating the
    in-core copy; for that reason, it is easier on the readers to
    use parse_object() if we know we want an in-core object *and*
    when we use it we want to see it parsed already).

> +static void clear_common_flag(struct oidset *s)
> +{
> +	struct oidset_iter iter;
> +	const struct object_id *oid;
> +	oidset_iter_init(s, &iter);
> +
> +	while ((oid = oidset_iter_next(&iter))) {
> +		struct object *obj = lookup_object(the_repository, oid);

This one obviously is OK ;-)  The fact we are clearing by definition
means we already do have in-core objects.

> +		obj->flags &= ~COMMON;
> +	}
> +}

Thanks.