Thread (1 message) 1 message, 1 author, 2016-06-15

Re: [PATCH 5/8] get-repack --max-pack-size: write_object() takes 'limit' arg

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:43:03

Dana How [off-list ref] writes:
Accept new 'limit' argument and check against it
before each group of writes.  Update delta usability rules
for possibility of delta base being in a previously-
written pack. Inline sha1write_compressed() so we know
the exact size of the written data when it needs to be compressed.

Signed-off-by: Dana How <redacted>
My first reaction of open-coding sha1write_compressed() was
"Ugh", but as you are removing the only user of that function,
maybe this is not as bad as it looks.
quoted hunk
@@ -407,6 +408,10 @@ static off_t write_object(struct sha1file *f,
 			if (revalidate_loose_object(entry, map, mapsize))
 				die("corrupt loose object %s",
 				    sha1_to_hex(entry->sha1));
+			if ( limit && mapsize + 20 >= limit ) {
+				munmap(map, mapsize);
+				return 0;
+			}
Our coding style guideline is similar to that of the kernel.  No
SP after '(' or before ')' in conditionals.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help