Re: [PATCH v6 3/4] receive-pack: move message generation to separate function
- From
Karthik Nayak <karthik.188@gmail.com>
- Date
- Sep 3, 2026, 16:32 UTC
- Message-ID
- <CAOLa=ZTZeO0DRh67TQ0uY=pWUrePwg09_=D_qyyM7ZigzvZLJg@mail.gmail.com>
- In-Reply-To
- <aplF-zxlGRqZs6tf@pks.im>
Patrick Steinhardt <ps@pks.im> writes:
Show 33 quoted lines
> On Thu, Sep 03, 2026 at 11:28:00AM +0200, Karthik Nayak wrote:
>> diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c
>> index a9a3d21c24..9ac10465ac 100644
>> --- a/builtin/receive-pack.c
>> +++ b/builtin/receive-pack.c
>> @@ -2535,67 +2535,72 @@ static void update_shallow_info(struct command *commands,
> [snip]
>> +static void report(struct command *commands, const char *unpack_status)
>> +{
>> + struct strbuf buf = STRBUF_INIT;
>> +
>> + generate_report(&buf, commands, unpack_status, REPORT_STATUS_V0);
>> +
>> + if (use_sideband)
>> + send_sideband(1, 1, buf.buf, buf.len, use_sideband);
>> + else
>> + write_or_die(1, buf.buf, buf.len);
>> + strbuf_release(&buf);
>> +}
>> +
>> +static void report_v2(struct command *commands, const char *unpack_status)
>> +{
>> + struct strbuf buf = STRBUF_INIT;
>> +
>> + generate_report(&buf, commands, unpack_status, REPORT_STATUS_V2);
>>
>> if (use_sideband)
>> send_sideband(1, 1, buf.buf, buf.len, use_sideband);
>
> A bit hard to see, but aren't these two functions now exactly the same
> except for the enum passed to `generate_report()`?
>
> PatrickOh yeah, that's a neat consequence I didn't even see. I'll definitely send in a new version with this change.