Re: [PATCH v2 06/10] blob.c: remove parse_blob_buffer()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ævar Arnfjörð Bjarmason  <avarab@xxxxxxxxx> writes:

> -int parse_blob_buffer(struct blob *item, void *buffer, unsigned long size)
> -{
> -	item->object.parsed = 1;
> -	return 0;
> -}

Understandable.

> diff --git a/object.c b/object.c
> index 78343781ae..f4e419e5c3 100644
> --- a/object.c
> +++ b/object.c
> @@ -195,8 +195,7 @@ struct object *parse_object_buffer(struct repository *r, const struct object_id
>  	if (type == OBJ_BLOB) {
>  		struct blob *blob = lookup_blob(r, oid);
>  		if (blob) {
> -			if (parse_blob_buffer(blob, buffer, size))
> -				return NULL;
> +			blob->object.parsed = 1;
>  			obj = &blob->object;
>  		}

Understandable, too.

>  	} else if (type == OBJ_TREE) {
> @@ -262,12 +261,16 @@ struct object *parse_object(struct repository *r, const struct object_id *oid)
>  	if ((obj && obj->type == OBJ_BLOB && repo_has_object_file(r, oid)) ||
>  	    (!obj && repo_has_object_file(r, oid) &&
>  	     oid_object_info(r, oid, NULL) == OBJ_BLOB)) {
> +		if (!obj) {
> +			struct blob *blob = create_blob(r, oid);
> +			obj = &blob->object;
> +		}

I do not recall this change explained or justified in the log
message.  What am I missing?

>  		if (check_object_signature(r, repl, NULL, 0, NULL) < 0) {
>  			error(_("hash mismatch %s"), oid_to_hex(oid));
>  			return NULL;
>  		}
> -		parse_blob_buffer(lookup_blob(r, oid), NULL, 0);
> -		return lookup_object(r, oid);
> +		obj->parsed = 1;
> +		return obj;

Likewise.  Why isn't it just a call to lookup_blob() followed by
setting of its .parsed bit?  

In other words, it is not clear why we need to expose create_blob().

>  	}
>  
>  	buffer = repo_read_object_file(r, oid, &type, &size);




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux