From: Maciej Ciemborowicz Date: Thu, 08 Oct 2026 09:44:16 GMT Subject: [PATCH v4 1/4] refs: distinguish internal transactions from logical updates Message-ID: <948927d8fb4ca94742294d4f423ee1cb9819a7ae.1791452597.git.maciej.ciemborowicz@gmail.com> In-Reply-To: A ref backend may use a nested transaction to persist part of a logical update. Provide an internal-only transaction flag so that these physical updates can avoid reporting the same operation to reference-transaction hooks again. Keep the check in run_transaction_hook(), covering every hook state in one place. The flag is deliberately not part of the public refs API. Subsequent changes use it for packed-refs updates belonging to a copy or rename. Signed-off-by: Maciej Ciemborowicz --- refs.c | 3 +++ refs/refs-internal.h | 3 +++ 2 files changed, 6 insertions(+) diff --git a/refs.c b/refs.c index 951db56113..642f895b71 100644 --- a/refs.c +++ b/refs.c @@ -2689,6 +2689,9 @@ static int run_transaction_hook(struct ref_transaction *transaction, struct run_hooks_opt opt = RUN_HOOKS_OPT_INIT; int ret = 0; + if (transaction->flags & REF_TRANSACTION_FLAG_INTERNAL) + return 0; + strvec_push(&opt.args, state); opt.feed_pipe = transaction_hook_feed_stdin; diff --git a/refs/refs-internal.h b/refs/refs-internal.h index c3ac7b556f..0b41f5fa4b 100644 --- a/refs/refs-internal.h +++ b/refs/refs-internal.h @@ -8,6 +8,9 @@ struct fsck_options; struct ref_transaction; +/* Physical updates nested in a transaction already reported to hooks. */ +#define REF_TRANSACTION_FLAG_INTERNAL (1 << 2) + /* * Data structures and functions for the internal use of the refs * module. Code outside of the refs module should use only the public -- 2.39.3 (Apple Git-146)