From: Toon Claes Date: Wed, 29 Apr 2026 12:24:15 GMT Subject: Re: [PATCH v3 6/9] update-ref: handle rejections while adding updates Message-ID: <87v7dagdjk.fsf@toon--20250203-5JQV3.mail-host-address-is-not-set> In-Reply-To: <20260427-refs-move-to-generic-layer-v3-6-e4638dfb7897@gmail.com> Karthik Nayak writes: > @@ -289,22 +300,35 @@ static void parse_cmd_update(struct ref_transaction *transaction, > if (*next != line_termination) > die("update %s: extra input: %s", refname, next); > > - if (ref_transaction_update(transaction, refname, > - &new_oid, have_old ? &old_oid : NULL, > - NULL, NULL, > - update_flags | create_reflog_flag, > - msg, &err)) > + tx_err = ref_transaction_update(transaction, refname, > + &new_oid, have_old ? &old_oid : NULL, > + NULL, NULL, > + update_flags | create_reflog_flag, > + msg, &err); > + > + /* > + * Generic errors are non-recoverable, so we cannot skip the update > + * or mark it as rejected. > + */ > + if (tx_err == REF_TRANSACTION_ERROR_GENERIC) > die("%s", err.buf); > > + if (tx_err && opts->allow_update_failures) > + print_rejected_refs(refname, have_old ? &old_oid : NULL, > + &new_oid, NULL, NULL, tx_err, err.buf, > + NULL); I realize I've made this suggestion, but I think I've made a mistake. When opts->allow_update_failures is falsey and tx_err is truthy we should die also. Don't we? I'm not sure what the nicest way is to write this, but maybe: if (tx_err) { if (tx_err == REF_TRANSACTION_ERROR_GENERIC || !opts->allow_update_failures) die("%s", err.buf); print_rejected_refs(refname, have_old ? &old_oid : NULL, &new_oid, NULL, NULL, tx_err, err.buf, NULL); } How did test coverage not find this? -- Cheers, Toon