Thread (6 messages) flat view 6 messages, 2 authors, 2016-06-15

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

From: Nicolas Pitre <hidden>
Date: 2016-06-15 22:43:03

On Sun, 8 Apr 2007, Dana How wrote:
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.
It would be cleaner if the compression code was made into a function of 
its own I think.
quoted hunk ↗ jump to hunk
@@ -448,6 +480,12 @@ static off_t write_object(struct sha1file *f,
 			header[pos] = ofs & 127;
 			while (ofs >>= 7)
 				header[--pos] = 128 | (--ofs & 127);
+			if ( limit && hdrlen + sizeof(header) - pos + datalen + 20 >= limit ) {
+				free(out);
+				free(buf);
+				return 0;
+			}
+			sha1write(f, header, hdrlen);
 			sha1write(f, header + pos, sizeof(header) - pos);
The above looks rather buggy to me.


Nicolas
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help