zstream: grow based on used memory rather than allocated

When deflating data, we might need to grow the buffer. Currently we
add a guess on top of the currently-allocated buffer size.

When we re-use the buffer, it already has some memory allocated; adding
to that means that we always grow the buffer regardless of how much we
need to use.

Instead, increase on top of the currently-used size. This still leaves
us with the allocated size of the largest object we compress, but it's a
minor pain compared to unbounded growth.

This fixes #2285.
pack-objects: always write out the status in write_one()

Make sure we set the output parameter to a value.
Merge pull request #2301 from libgit2/cmn/pack-objects-memory

Keep the deflate buffer from ballooning up