From: Patrick Steinhardt Date: Tue, 05 May 2026 05:52:24 GMT Subject: Re: [PATCH v4 6/9] update-ref: handle rejections while adding updates Message-ID: In-Reply-To: <20260504-refs-move-to-generic-layer-v4-6-936ac2f0b1a3@gmail.com> 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. > @@ -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. Other than that this patch looks good to me, thanks! Patrick