Subject: Re: [PULL REQUEST] initial pack v4 support

From: Junio C Hamano <[email-masked]>
Date: Tue, 10 Sep 2013 14:21:47 -0700

Nicolas Pitre <[email-masked]> writes:

> Junio, would you please pull the following into pu:
>
> 	git://git.linaro.org/people/nico/git
>
> This is the pack v4 work to date which is somewhat getting usable.  It 
> is time it gets more exposure, and possibly some more people's attention 
> who would like to work on the missing parts as I need to scale down my 
> own involvement.

Thanks.  Parked on 'pu'.

>       packv4-parse.c: allow tree entry copying from a canonical tree object

This one needed a small fix-up to make it compile.

I do not particularly like reusing that "size" variable, but it
seemed to be dead at that point, so...

 packv4-parse.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/packv4-parse.c b/packv4-parse.c
index f96acc1..3f95ed4 100644
--- a/packv4-parse.c
+++ b/packv4-parse.c
@@ -365,13 +365,14 @@ static int copy_canonical_tree_entries(struct packed_git *p, off_t offset,
 		update_tree_entry(&desc);
 	end = desc.buffer;
 
-	if (end - from > *sizep) {
+	size = (const char *)end - (const char *)from;
+	if (size > *sizep) {
 		free(data);
 		return -1;
 	}
-	memcpy(*dstp, from, end - from);
-	*dstp += end - from;
-	*sizep -= end - from;
+	memcpy(*dstp, from, size);
+	*dstp += size;
+	*sizep -= size;
 	free(data);
 	return 0;
 }
-- 
1.8.4-468-g1185e84