From: Maciej Ciemborowicz Date: Wed, 07 Oct 2026 18:05:14 GMT Subject: [PATCH v3 1/4] refs: distinguish internal transactions from logical updates Message-ID: <6d7c146e57b3e626a0469f2289d375652ed8fec1.1791395643.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 92d5df5b71..00b1b51280 100644 --- a/refs.c +++ b/refs.c @@ -2666,6 +2666,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)