Git development
 help / color / mirror / Atom feed
From: Junio C Hamano <junkio@cox.net>
To: Nicolas Pitre <nico@cam.org>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 2/6] many cleanups to sha1_file.c
Date: Sat, 23 Sep 2006 01:44:56 -0700	[thread overview]
Message-ID: <7v7izvug3b.fsf@assigned-by-dhcp.cox.net> (raw)
In-Reply-To: Pine.LNX.4.64.0609210004550.2627@xanadu.home

Nicolas Pitre <nico@cam.org> 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.

  reply	other threads:[~2006-09-23  8:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-21  4:05 [PATCH 2/6] many cleanups to sha1_file.c Nicolas Pitre
2006-09-23  8:44 ` Junio C Hamano [this message]
2006-09-24  4:17   ` Nicolas Pitre

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7v7izvug3b.fsf@assigned-by-dhcp.cox.net \
    --to=junkio@cox.net \
    --cc=git@vger.kernel.org \
    --cc=nico@cam.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox