git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 1/1] Add preparing state to reference-transaction hook

From
Peijian Ju <eric.peijian@gmail.com>
Date
Mar 16, 2026, 03:09 UTC
Message-ID
<CAN2LT1A=yMpMSDZoHGEFL7T8fw5OC5vbgL3DJ7U8xP6tOfVudQ@mail.gmail.com>
In-Reply-To
<xmqq7brf1g3e.fsf@gitster.g>
On Fri, Mar 13, 2026 at 7:10 PM Junio C Hamano <gitster@pobox.com> wrote:
Show 33 quoted lines
>
> Justin Tobler <jltobler@gmail.com> 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").

Show 15 quoted lines
> >> +    }
> >> +
> >>      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
Previous: Junio C HamanoNext: Eric Ju
Message 7 of 15 in “Add "preparing" phase to reference-transaction hook”
  1. 0/1 Add "preparing" phase to reference-transaction hookeric.peijian@gmail.com, Mar 13, 2026
  2. 1/1 Add preparing state to reference-transaction hookeric.peijian@gmail.com, Mar 13, 2026
  3. Junio C HamanoMar 13, 2026
  4. Peijian JuMar 16, 2026
  5. Justin ToblerMar 13, 2026
  6. Junio C HamanoMar 13, 2026
  7. Peijian JuMar 16, 2026
  8. 0/1 refs: add 'preparing' phase to the reference-transaction hookEric Ju, Mar 16, 2026
  9. 1/1 refs: add 'preparing' phase to the reference-transaction hookEric Ju, Mar 16, 2026
  10. Junio C HamanoMar 16, 2026
  11. Peijian JuMar 16, 2026
  12. Patrick SteinhardtMar 16, 2026
  13. Peijian JuMar 16, 2026
  14. 0/1 refs: add 'preparing' phase to the reference-transaction hookEric Ju, Mar 17, 2026
  15. 1/1 refs: add 'preparing' phase to the reference-transaction hookEric Ju, Mar 17, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.