Show 33 quoted lines
> Karthik Nayak <karthik.188@gmail.com> 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?
>Show 13 quoted lines
> 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?
>