Subject: Re: [PATCH v2 2/6] refs: allow passing flags when beginning transactions

From: Junio C Hamano <[email-masked]>
Date: Fri, 07 Jan 2022 17:51:07 -0800

Patrick Steinhardt <[email-masked]> writes:

> We do not currently have any flags when creating reference transactions,
> but we'll add one to disable execution of the reference transaction hook
> in some cases.
>
> Allow passing flags to `ref_store_transaction_begin()` to prepare for
> this change.
>
> Signed-off-by: Patrick Steinhardt <[email-masked]>
> ---
>  refs.c                |  8 +++++---
>  refs.h                |  3 ++-
>  refs/files-backend.c  | 10 +++++-----
>  refs/packed-backend.c |  2 +-
>  refs/refs-internal.h  |  1 +
>  sequencer.c           |  2 +-
>  6 files changed, 15 insertions(+), 11 deletions(-)
>
> diff --git a/refs.c b/refs.c
> index 4da4996c4d..7415864b62 100644
> --- a/refs.c
> +++ b/refs.c
> @@ -800,7 +800,7 @@ int refs_delete_ref(struct ref_store *refs, const char *msg,
>  	struct ref_transaction *transaction;
>  	struct strbuf err = STRBUF_INIT;
>  
> -	transaction = ref_store_transaction_begin(refs, &err);
> +	transaction = ref_store_transaction_begin(refs, 0, &err);

Ah, OK, the "later" came soon enough.  It wasn't that we wanted to
cram multiple calls for "delete" in a single transaction.  It was
that we wanted to tweak how each transaction works by passing a
flag word.

>  struct ref_transaction *ref_store_transaction_begin(struct ref_store *refs,
> +						    unsigned int flags,
>  						    struct strbuf *err)

OK.  And in this step, everybody passes 0 (i.e. no bit set) to the
function.