From: Karthik Nayak Date: Thu, 03 Sep 2026 16:32:00 GMT Subject: Re: [PATCH v6 3/4] receive-pack: move message generation to separate function Message-ID: In-Reply-To: Patrick Steinhardt writes: > 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()`? > > Patrick Oh yeah, that's a neat consequence I didn't even see. I'll definitely send in a new version with this change.