Re: [PATCH v13 5/7] object-file.c: add "stream_loose_object()" to handle large object
- From
- Han Xin <chiyutianyi@gmail.com>
- Date
- Jun 9, 2022, 06:14 UTC
- Message-ID
- <CAO0brD3tq-18p8g3P7DX=L=2zzUJnZXN_CRisM4cFRDhpZpU-g@mail.gmail.com>
- In-Reply-To
- <xmqqy1y960hq.fsf@gitster.g>
On Tue, Jun 7, 2022 at 3:44 AM Junio C Hamano <gitster@pobox.com> wrote:
Show 11 quoted lines
> > > > "freshen_packed_object()" or "freshen_loose_object()" will be called > > inside "stream_loose_object()" after obtaining the "oid". > > That much we can read from the patch text. Saying just "we do X" > without explaining "why we do so" in the proposed log message leaves > readers more confused than otherwise. Why is it worth pointing out > in the proposed log message? Is the reason why we need to do so > involve something tricky? >
Yes, it really should be made clear why this is done here.
Thanks. -Han Xin
Show 17 quoted lines
> > + ret = end_loose_object_common(&c, &stream, oid);
> > + if (ret != Z_OK)
> > + die(_("deflateEnd on stream object failed (%d)"), ret);
> > + close_loose_object(fd, tmp_file.buf);
> > +
> > + if (freshen_packed_object(oid) || freshen_loose_object(oid)) {
> > + unlink_or_warn(tmp_file.buf);
> > + goto cleanup;
>
> So, we were told to write an object, we wrote to a temporary file,
> and we wanted to mark the object to be recent and found that there
> indeed is already the object. We remove the temporary and do not
> leave the new copy of the object, and the value of err at this point
> is 0 (success) which is what is returned from cleanup: label.
>
> Good.
>