Subject: Re: [PATCH 4/6] update-ref: utilize rejected error details if available

From: Junio C Hamano <[email-masked]>
Date: Wed, 14 Jan 2026 09:27:28 -0800

Karthik Nayak <[email-masked]> writes:

> @@ -573,16 +573,18 @@ static void print_rejected_refs(const char *refname,
>  				const char *old_target,
>  				const char *new_target,
>  				enum ref_transaction_error err,
> -				const char *details UNUSED,
> +				const char *details,
>  				void *cb_data UNUSED)
>  {
>  	struct strbuf sb = STRBUF_INIT;
> -	const char *reason = ref_transaction_error_msg(err);
>  
> -	strbuf_addf(&sb, "rejected %s %s %s %s\n", refname,
> -		    new_oid ? oid_to_hex(new_oid) : new_target,
> -		    old_oid ? oid_to_hex(old_oid) : old_target,
> -		    reason);
> +	if (details)
> +		strbuf_addf(&sb, "%s\n", details);
> +	else
> +		strbuf_addf(&sb, "rejected %s %s %s %s\n", refname,
> +			    new_oid ? oid_to_hex(new_oid) : new_target,
> +			    old_oid ? oid_to_hex(old_oid) : old_target,
> +			    ref_transaction_error_msg(err));

Could "details" reported from the lower layer be less detailed than
what we are formulating here, like updating the value of what ref
from what old object to what new object, or what the err code tells
the end-user?