From: Peijian Ju Date: Mon, 16 Mar 2026 03:09:33 GMT Subject: Re: [PATCH 1/1] Add preparing state to reference-transaction hook Message-ID: In-Reply-To: On Fri, Mar 13, 2026 at 7:10 PM Junio C Hamano wrote: > > Justin Tobler writes: > > > On 26/03/13 03:35PM, eric.peijian@gmail.com wrote: > >> diff --git a/refs.c b/refs.c > >> index 6fb8f9d10c..f1439476d3 100644 > >> --- a/refs.c > >> +++ b/refs.c > >> @@ -2655,6 +2655,13 @@ int ref_transaction_prepare(struct ref_transaction *transaction, > >> if (ref_update_reject_duplicates(&transaction->refnames, err)) > >> return REF_TRANSACTION_ERROR_GENERIC; > >> > >> + /* Preparing checks before locking references */ > >> + ret = run_transaction_hook(transaction, "preparing"); > >> + if (ret) { > >> + ref_transaction_abort(transaction, err); > >> + die(_("ref updates aborted by %s hook"), "preparing"); > > > > Should "preparing" be marked for translation here? > > It literally is one of the possible tokens reference-transaction > hook is given as its argument, so no, I do not think "preparing" > should be translated. > > But the hook that interrupted the ref update is not "preparing" > hook. It is the "reference-transaction" hook. So the message > probably should say something like > > the reference-transaction hook rejected ref updates at its > preparing phase > > or something. > Thanks for the clarification. Fixed, the message now reads: "ref updates aborted by the reference-transaction hook at its preparing phase" (and likewise for "prepared"). > >> + } > >> + > >> ret = refs->be->transaction_prepare(refs, transaction, err); > >> if (ret) > >> return ret; > >> @@ -2662,7 +2669,7 @@ int ref_transaction_prepare(struct ref_transaction *transaction, > >> ret = run_transaction_hook(transaction, "prepared"); > >> if (ret) { > >> ref_transaction_abort(transaction, err); > >> - die(_("ref updates aborted by hook")); > >> + die(_("ref updates aborted by %s hook"), "prepared"); > > > > Same question here for "prepared"? > > Ditto. Ditto. Thank you. - Eric