Re: [PATCH v2 1/1] refs: add 'preparing' phase to the reference-transaction hook
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Mar 16, 2026, 16:24 UTC
- Message-ID
- <xmqqv7evpwrr.fsf@gitster.g>
- In-Reply-To
- <20260316045102.70551-2-eric.peijian@gmail.com>
Eric Ju <eric.peijian@gmail.com> writes:
Show 6 quoted lines
> + /* Preparing checks before locking references */
> + ret = run_transaction_hook(transaction, "preparing");
> + if (ret) {
> + ref_transaction_abort(transaction, err);
> + die(_("ref updates aborted by the reference-transaction hook at its %s state"), "preparing");
> + }On end-user's terminal, the above should look like
fatal: ref updates aborted by the reference-transaction hook at its parparing state
consuming more than 80 columns and having the varying part of the message at the very end. Can we shorten this and highlight the more important bits? Here is my attempt
die(_("in '%s' phase, update aborted by the reference-transaction hook"),
"preparing");Enclosing the phase name in 'quotes' and moving it near the beginning are both my attempt to make it stand out more.
Another thing you may want to consider is to extract the message to a separate constant, i.e.,
const char *abort_by_ref_transaction_hook[] =
N_("in '%s' phase, update aborted by the reference-transaction hook");and reuse at two places, perhaps?
die(_(abort_by_ref_transaction_hook), "preparing");