Thread (2 messages) flat view 2 messages, 2 authors, 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

Junio C Hamano [off-list ref] writes:
Dana How [off-list ref] writes:
quoted
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.
Having said that, I suspect that for other possible users of
that function we might have later, it would be a better
interface to add an optional 'limit' and 'prelude' to
sha1write_compressed().  The function would write prelude
followed by the compressed payload, only if they fit the limit.

Then your write_object() would prepare the header (depending on
the type, the object header, ofs-delta header or ref-delta
header) in header[] but would not cal sha1write() itself.
Instead it would send header[] in as prelude, *buf as the
payload, with an appropriate limit.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help