From: Karthik Nayak Date: Tue, 05 May 2026 08:23:39 GMT Subject: Re: [PATCH v4 6/9] update-ref: handle rejections while adding updates Message-ID: In-Reply-To: Patrick Steinhardt writes: > On Mon, May 04, 2026 at 07:44:10PM +0200, Karthik Nayak wrote: >> diff --git a/builtin/update-ref.c b/builtin/update-ref.c >> index 5259cc7226..6355c3dd3e 100644 >> --- a/builtin/update-ref.c >> +++ b/builtin/update-ref.c >> @@ -257,6 +266,31 @@ static void print_rejected_refs(const char *refname, >> strbuf_release(&sb); >> } >> >> +/* >> + * Handle transaction errors. If we're using batches updates, we want to only >> + * die for generic errors and print the remaining to the user. >> + */ >> +static void handle_ref_transaction_error(const char *refname, >> + struct object_id *new_oid, >> + struct object_id *old_oid, >> + const char *new_target, >> + const char *old_target, >> + enum ref_transaction_error tx_err, >> + struct strbuf *err, >> + struct command_options *opts) >> +{ >> + if (!tx_err) >> + return; >> + >> + if (tx_err != REF_TRANSACTION_ERROR_GENERIC && opts->allow_update_failures) { >> + print_rejected_refs(refname, old_oid, new_oid, old_target, >> + new_target, tx_err, err->buf, NULL); >> + return; >> + } >> + >> + die("%s", err->buf); >> +} > > It's a bit weird that we pass in the error message as a strbuf given > that we really only care about the actual message. > That's fair. I will add this locally but I think it is also not worth a re-roll. >> @@ -644,6 +699,10 @@ static void update_refs_stdin(unsigned int flags) >> struct ref_transaction *transaction; >> int i, j; >> >> + struct command_options opts = { >> + .allow_update_failures = flags & REF_TRANSACTION_ALLOW_FAILURE, >> + }; >> + > > Nit: stray empty line between the variable declarations. > Same here. > Other than that this patch looks good to me, thanks! > > Patrick > I'll hold off on a re-roll unless needed. Thanks for the review again!