From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS53758 23.128.96.0/24 X-Spam-Status: No, score=-4.0 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by dcvr.yhbt.net (Postfix) with ESMTP id CB46B1F953 for ; Tue, 7 Dec 2021 10:57:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235463AbhLGLAR (ORCPT ); Tue, 7 Dec 2021 06:00:17 -0500 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:44857 "EHLO out4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235466AbhLGLAQ (ORCPT ); Tue, 7 Dec 2021 06:00:16 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 3D2F25C0039; Tue, 7 Dec 2021 05:56:46 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Tue, 07 Dec 2021 05:56:46 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; h=date :from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm2; bh=z/MQqbskvrmSpKBAcDfjMcY0Lkm u//JN6oxgS/8PpMk=; b=q57wPpj4uBmirYPxV7oI/djAClmXQw7Mlo1nhvzsJlj tVd5SvD62NCj9noGiB7Kq4yHl4rf9IukQoPqK+8h8nmjdVuegNp3qBndMLEgbzl6 BDtjO+0X4UVJOzhv4NO3SlPfxv3yDcdnjf24MNkTZfDvYXmv1pS+FdUvWpyV8k4c xP4l6R7dpfw9o5zOcqpy0pfdmr2HfuBI3QhCtmqshaoJF+ag1qyefUCCUrksK4gZ H+UlhK5P9GVmf1DX7Xy9TDXmWVXd0kj/603DNooaNk1ArXPrgSFNY71GwvGmWEmD shvcY96vPvQIECBsyLLco24q+CRhgECPQrtRVdmn7Dw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=z/MQqb skvrmSpKBAcDfjMcY0Lkmu//JN6oxgS/8PpMk=; b=SxFF3MaYZptGnQk28tq+MA fhOkh8y/80/7FZpk3OU58xFbfnzCWZEejzraLUIB1Wni9dmIwy9sLbEbIJ94wUS4 ExK/d8nba9cdUYFyqSkFqrS4MoJBILfAod3ETTYeSKIhdHQS8AwFQuj/KN8a3g+R Z8byyLw052rksWuWHSkXbtjyG+GoJt+3qn7mSgpeVHgid8gLmJNi+wt5ZZC0Cw/T lj5frw7hkfu09y17yRmc8GwPjQntENMpN9ajuiJRKt0tjeFfLYM0Xdks/2mjDzpK QlluDYB2a5cW8zaxwMr5WnRHSpr5rWr7kWSiRlf6sZCNhfs7xT2EM2G3NFt9HRjQ == X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvuddrjeehgddvfecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpeffhffvuffkfhggtggujgesghdtreertddtvdenucfhrhhomheprfgrthhrihgt khcuufhtvghinhhhrghrughtuceophhssehpkhhsrdhimheqnecuggftrfgrthhtvghrnh epheeghfdtfeeuffehkefgffduleffjedthfdvjeektdfhhedvlefgtefgvdettdfhnecu vehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepphhssehpkh hsrdhimh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 7 Dec 2021 05:56:45 -0500 (EST) Received: from localhost (ncase [10.192.0.11]) by vm-mail.pks.im (OpenSMTPD) with ESMTPSA id 044aa871 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Tue, 7 Dec 2021 12:26:23 +0000 (UTC) Date: Tue, 7 Dec 2021 11:56:05 +0100 From: Patrick Steinhardt To: git@vger.kernel.org Cc: Jeff King , Bryan Turner , Waleed Khan Subject: [PATCH 3/6] refs: allow skipping the reference-transaction hook Message-ID: <0e42fc07f80903135bae10ac91e139f85ca9db54.1638874287.git.ps@pks.im> References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="g+ZDtJ8yl5GmoyI6" Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org --g+ZDtJ8yl5GmoyI6 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable The reference-transaction hook is executing whenever we prepare, commit or abort a reference transaction. While this is mostly intentional, in case of the files backend we're leaking the implementation detail that the store is in fact a composite store with one loose and one packed backend to the caller. So while we want to execute the hook for all logical updates, executing it for such implementation details is unexpected. Prepare for a fix by adding a new flag which allows to skip execution of the hook. Signed-off-by: Patrick Steinhardt --- refs.c | 3 +++ refs.h | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/refs.c b/refs.c index 1c8a0c01f1..462e629d37 100644 --- a/refs.c +++ b/refs.c @@ -2076,6 +2076,9 @@ static int run_transaction_hook(struct ref_transactio= n *transaction, const char *hook; int ret =3D 0, i; =20 + if (transaction->flags & REF_TRANSACTION_SKIP_HOOK) + return 0; + hook =3D find_hook("reference-transaction"); if (!hook) return ret; diff --git a/refs.h b/refs.h index e3d3b7aa14..840fa02613 100644 --- a/refs.h +++ b/refs.h @@ -546,6 +546,11 @@ enum action_on_err { UPDATE_REFS_QUIET_ON_ERR }; =20 +/* + * Skip executing the reference-transaction hook. + */ +#define REF_TRANSACTION_SKIP_HOOK (1 << 0) + /* * Begin a reference transaction. The reference transaction must * be freed by calling ref_transaction_free(). --=20 2.34.1 --g+ZDtJ8yl5GmoyI6 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEF9hrgiFbCdvenl/rVbJhu7ckPpQFAmGvPcQACgkQVbJhu7ck PpSdLxAAlpiaMRlDbgQUJrEfxHoHuK8nM/rN0ZQNqQWyuu0Dn/S7UBmjoNMo7G0E Jnkq/VCkyZrrHjij5R6vQ9Uw0nUJWat9lFpn0gY3He8bWkZGtk10Q2K1sVjoPtnT okePvv5C7DDAVn6VEodKs+t3oSaVJBV3LpZ1StzzEfRAwoj+xiuquqcqBaL5LniG A7itKKR/silZDrMaLu/FFEq+Pz42x+PHBBNwC3/qBcvKsOaSZcq7Jtj4dtRZOJX5 Oy57C+1sq65q/z3ZEsvfk+Sxe9haLFoyLpE6QkZuWTly63JJDEVoLq3/8ReR/a+D SWNMUd3FWxt783W91IujNj4t8M1eapSstTdNLUBDPnANGlibWvXwVx2kLMNbnUfy XXVoQ5rb3NPO4KqUrdUfFvtDUpfn5AAIMEuQuZOtd6inkg8r6gDNM5CumY1KdtFj SE6MUjlDMPniEywQ8qKNlHZuFK8gxHx8MghIOPdzBWFrxDa3mZXehfaboelg0VCl 2/GQnGwHxlAjFBH8/zTo7Fn+Pv728FZmSHCU8AOlKZcW286gBk8Ul/SmSjFJbiI/ 4rHvYaAh0qJCsXkM8hME6Byq0LwwuYGEtOsCRqTYKyVWC52B9l/mUUCX/+jTjpDO 6JiQfTtd7F3z+9NtelffqXepIiUdTXB8FM2hGWJBuDbJaItb06E= =vSlw -----END PGP SIGNATURE----- --g+ZDtJ8yl5GmoyI6--