Re: [RFC][PATCH] object.c: use has_object() instead of repo_has_object_file()

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

 



Jeff King <peff@xxxxxxxx> writes:
> I.e., I'd suggest this patch to remove both calls entirely:
> 
> diff --git a/object.c b/object.c
> index 248530ba7b..a370545405 100644
> --- a/object.c
> +++ b/object.c
> @@ -285,9 +285,8 @@ struct object *parse_object_with_flags(struct repository *r,
>  			return &commit->object;
>  	}
>  
> -	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 && obj->type == OBJ_BLOB) ||
> +	    (!obj && oid_object_info(r, oid, NULL) == OBJ_BLOB)) {
>  		if (!skip_hash && stream_object_signature(r, repl) < 0) {
>  			error(_("hash mismatch %s"), oid_to_hex(oid));
>  			return NULL;
> 
> But there may be some subtlety I'm missing. I'm cc-ing Jonathan Tan, who
> added has_object(), and who added the top call to repo_has_object_file()
> via df11e19648 (rev-list: support termination at promisor objects,
> 2017-12-08).

Thanks for CC-ing me on this. Looking at that commit and the code at that time,
I'm not sure why I added that call either. My best guess is that I was worried
that the streaming interface wouldn't support missing objects, but both then
and now, a call to istream_source() is made before any streaming occurs (which
does perform the lazy fetch).

So yes, I also think that you can remove these calls.



[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