Re: [PATCH 2/6] many cleanups to sha1_file.c

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

 



Nicolas Pitre <nico@xxxxxxx> writes:

> Those cleanups are mainly to set the table for the support of deltas
> with base objects referenced by offsets instead of sha1.  This means
> that many pack lookup functions are converted to take a pack/offset
> tuple instead of a sha1.

There still remains some "struct pack_entry" and I wonder if it
would make sense to get rid of them if only for consistency's
sake.

> diff --git a/sha1_file.c b/sha1_file.c
> index b89edb9..6fae766 100644
> --- a/sha1_file.c
> +++ b/sha1_file.c
> @@ -926,8 +925,8 @@ static int packed_delta_info(unsigned ch
>  
>  		memset(&stream, 0, sizeof(stream));
>  
> -		data = stream.next_in = base_sha1 + 20;
> -		stream.avail_in = left - 20;
> +		data = stream.next_in = (unsigned char *) p->pack_base + offset;;
> +		stream.avail_in = p->pack_size - offset;
>  		stream.next_out = delta_head;
>  		stream.avail_out = sizeof(delta_head);
>  

";;"?

> @@ -989,75 +988,60 @@ int check_reuse_pack_delta(struct packed
>  ...
> +static int packed_object_info(struct packed_git *p, unsigned long offset,
>  			      char *type, unsigned long *sizep)
>  {
> +	unsigned long size;
>  	enum object_type kind;
>  
> -	if (use_packed_git(p))
> -		die("cannot map packed file");
> +	offset = unpack_object_header(p, offset, &kind, &size);
>  

Do all callers of packed_object_info() call use_packed_git to
make sure p is mapped?  Ah sha1_object_info() is the only one
except packed_delta_info() that calls itself and it protects it
with use_packed_git(), so you are safe.

We would need to revamp use/unuse code when we implement the
partial mapping anyway, but we still need to get this right for
now.

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[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]