On Thu, Aug 14, 2014 at 11:58 PM, Junio C Hamano <gitster@xxxxxxxxx> wrote: >> +static void inflate_and_throw_away(unsigned long size) >> +{ > > But more importantly, the basic structure of this loop is the same > as the loop we already have in the only caller of this new function, > not just the regular "zlib produced this much that is not yet the > expected size, go on reading more" and "we are at the end of the > stream with Z_STREAM_END, and we are done", but even to "the stream > is corrupt, we need to exit the loop", they are identical. Is a > copy-and-paste like this the best we can do to add this "skip to the > end of the current stream"? We would really want to keep the number > of copies of this loop down; we saw a same bug introduced on the > termination condition multiple times to different copies X-<. I know. I'm the author of one of those bugs. I considered updating the inflate loop in get_data() to support this throw-away mode but was afraid I may make the same mistake like in index-pack again. I'll probably drop this patch and think if I can unify inflate loop (for other places too, not just unpack-objects). -- Duy -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html