Re: [PATCH v2 2/8] odb/streaming: drop `is_finished` field
- From
Karthik Nayak <karthik.188@gmail.com>
- Date
- Aug 11, 2026, 10:02 UTC
- Message-ID
- <CAOLa=ZQtdUKeuhNbxLC3kBTT9JbxgM8wJUGCzPNKJmEEscA4TA@mail.gmail.com>
- In-Reply-To
- <20260805-pks-odb-stream-unification-v2-2-b8c369564641@pks.im>
Patrick Steinhardt <ps@pks.im> writes:
[snip]
Show 32 quoted lines
> diff --git a/builtin/unpack-objects.c b/builtin/unpack-objects.c
> index f3e0b504f4..b7c486ea94 100644
> --- a/builtin/unpack-objects.c
> +++ b/builtin/unpack-objects.c
> @@ -368,20 +368,20 @@ static ssize_t feed_input_zstream(struct odb_write_stream *in_stream,
> {
> struct input_zstream_data *data = in_stream->data;
> git_zstream *zstream = data->zstream;
> - void *in = fill(1);
>
> - if (in_stream->is_finished)
> + if (data->status != Z_OK)
> return 0;
>
> zstream->next_out = buf;
> zstream->avail_out = buf_len;
> - zstream->next_in = in;
> - zstream->avail_in = len;
>
> - data->status = git_inflate(zstream, 0);
> + while (data->status == Z_OK && zstream->avail_out == buf_len) {
> + zstream->next_in = fill(1);
> + zstream->avail_in = len;
> + data->status = git_inflate(zstream, 0);
> + use(len - zstream->avail_in);
> + }
>
> - in_stream->is_finished = data->status != Z_OK;
> - use(len - zstream->avail_in);
> return buf_len - zstream->avail_out;
> }
>So we have a bunch of global variables used for zstream parsing. The loop ensures that we keep trying until we get some data. The use() function manipulate `len` accordingly for the next iteration..
[snip]