From patchwork Thu Feb 25 05:50:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 12103301 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CFBCDC433E0 for ; Thu, 25 Feb 2021 05:51:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 780F964EBA for ; Thu, 25 Feb 2021 05:51:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235131AbhBYFvC (ORCPT ); Thu, 25 Feb 2021 00:51:02 -0500 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:56831 "EHLO out3-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231274AbhBYFvB (ORCPT ); Thu, 25 Feb 2021 00:51:01 -0500 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 84DC75C00C2; Thu, 25 Feb 2021 00:50:15 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Thu, 25 Feb 2021 00:50:15 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; h=date :from:to:cc:subject:message-id:mime-version:content-type; s=fm3; bh=+84GoLOLOYFQd3fGvgG/IxZA0VWdWUO7BjFdrQjlpAQ=; b=j57VxdPMGnZY MLwIgLX2PPojmd+9ElrKc93OZWftWewjbPoJojYGr7fxfaWMPxMR6lBL1ESU+XPE 6dPEQhtwBp2gTOviU0QeqOUWUIYpKIR1RBr3npcWt3QvNDfBtThtzx0AAkMlV+W+ OIDRqr/Xpz8yt+wVoWtr+I5JjiOAp5o+PnlVixGm7r061t3TZjMOOcTDlsTXo0bh xIfafI/NJ80Zu9t5lZL+znwsPRYHenR4fUMnC/G+0plHcfMeDLfI75P1KAnPuYPQ AZcuO/Qmj1H0rsssAI/XsUBfUn7SBmaFcP5Q8t3SeXk5OE1HSmPs0u4A5J0UgsuG 62e+nroblw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:message-id :mime-version:subject:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm2; bh=+84GoLOLOYFQd3fGvgG/IxZA0VWdW UO7BjFdrQjlpAQ=; b=VW2b/BkUeSKcHKiDsSbFW0+m0L9Xa+Wg0KiGNrfSP4r8H hAV3MrF4wCiX5FYaTVEBYCIigSp1CUrx408COs0KPBpvZ0cbxi9Xw0TeuyW2Ow4B a2ZCi61pSJwXzYHPE9oFgo0Twmd8P4cX5MDXUksMQR92NaOyYPHpdyjMVFof4bxB 0O1zVNSImfgGCyrMaRFa6yWbTN5yZdTlW3yh4xLC+UojVEOWXdfXW3nvmJIgrJj1 azLqaPdKmbnjm7MfNMVCm6hLVckMUCI6IjxSQVsJQJ7NaU+mF2YjnxwaDJZmi46E fK8PkrkhMiAuBmyXHbv+ay51e/t4w/y4DKXHJFLdg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrkeekgdekjecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpeffhffvuffkgggtugesghdtreertddtvdenucfhrhhomheprfgrthhrihgtkhcu ufhtvghinhhhrghrughtuceophhssehpkhhsrdhimheqnecuggftrfgrthhtvghrnhepje eifedvueelfffgjeduffdvgefhiefgjefgvddvfeduvefffeevfffhgfekieffnecukfhp peejjedrudekfedrvdefrdelnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpe hmrghilhhfrhhomhepphhssehpkhhsrdhimh X-ME-Proxy: Received: from vm-mail.pks.im (x4db71709.dyn.telefonica.de [77.183.23.9]) by mail.messagingengine.com (Postfix) with ESMTPA id 7EC6B240057; Thu, 25 Feb 2021 00:50:14 -0500 (EST) Received: from localhost (ncase [10.192.0.11]) by vm-mail.pks.im (OpenSMTPD) with ESMTPSA id a153fba2 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Thu, 25 Feb 2021 05:50:13 +0000 (UTC) Date: Thu, 25 Feb 2021 06:50:12 +0100 From: Patrick Steinhardt To: git@vger.kernel.org Cc: Jeff King , Yaron Wittenstein , Junio C Hamano Subject: [PATCH] githooks.txt: Clarify documentation on reference-transaction hook Message-ID: MIME-Version: 1.0 Content-Disposition: inline Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The reference-transaction hook doesn't clearly document its scope and what values it receives as input. Document it to make it less surprising and clearly delimit its (current) scope. Signed-off-by: Patrick Steinhardt --- I've been postponing doing this simple doc update for far too long, but here it finally is. It simply clarifies its current workings and limitations without changing anything. This is not supposed to be a "We don't want it to ever cover symrefs", but rather to avoid confusion. Patrick Documentation/githooks.txt | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Documentation/githooks.txt b/Documentation/githooks.txt index 1f3b57d04d..b01de04702 100644 --- a/Documentation/githooks.txt +++ b/Documentation/githooks.txt @@ -473,7 +473,8 @@ reference-transaction This hook is invoked by any Git command that performs reference updates. It executes whenever a reference transaction is prepared, -committed or aborted and may thus get called multiple times. +committed or aborted and may thus get called multiple times. The hook +does not cover symbolic references. The hook takes exactly one argument, which is the current state the given reference transaction is in: @@ -492,6 +493,13 @@ receives on standard input a line of the format: SP SP LF +where `` is the old object name passed into the reference +transaction, `` is the new object name to be stored in the +ref and `` is the full name of the ref. When force updating +the reference regardless of its current value or when the reference is +to be created anew, `` is 40 `0`. To distinguish these cases, +you can inspect the current value of `` via `git rev-parse`. + The exit status of the hook is ignored for any state except for the "prepared" state. In the "prepared" state, a non-zero exit status will cause the transaction to be aborted. The hook will not be called with From patchwork Mon Mar 1 09:43:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 12109267 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 15B39C433DB for ; Mon, 1 Mar 2021 09:45:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B3037601FE for ; Mon, 1 Mar 2021 09:45:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234025AbhCAJpC (ORCPT ); Mon, 1 Mar 2021 04:45:02 -0500 Received: from wout4-smtp.messagingengine.com ([64.147.123.20]:49663 "EHLO wout4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233762AbhCAJop (ORCPT ); Mon, 1 Mar 2021 04:44:45 -0500 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id D6D989F3; Mon, 1 Mar 2021 04:43:59 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Mon, 01 Mar 2021 04:44:00 -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=fm3; bh=5eSJ1o9I1vIBzVIp2n9aNS4jUYf zDZbmzklzs+YKJw4=; b=f5cTUM9x6CsST9lpNB1TWe+oa3OfqF9pxuO7J8+vViD zOOjIqm4t05jT9zzjGi5nb9xUyrE5SK+3clV8jAF/Ct9vDP22T6mNcFuJVUaIQhr F/x2BLs45mSKKOkFqHNmM7O2F90gnbK/BW4c7kmDXAH8WnpvHWtBoL6COOIdnlOa ouuNw+dgUJ0Wjj/LBPWrV/37PzS8CPlfZB9lErOLDBjMnHmcMVQrfv64YRPEYTvq 4hIURepEf6jh5/OW8LhT4FUWy8PIRcWla9/0RMefwVmp40hKy9EzQUwV2NruEhEP pFLoAKYqhcwHtPwB3uIxATVhljdvZ41g5hALotR9/WA== 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=fm2; bh=5eSJ1o 9I1vIBzVIp2n9aNS4jUYfzDZbmzklzs+YKJw4=; b=MvKerOKSES+Ne1YZjHvVqW XEmkQlBbHHVnDwwLrxHq9iFdiDeieBE6uitA85MmzYCWOtSJ5YUGZvFh6Qj2ehJL tJ6PPRk8XXn6fo7cuoDt5atn4E/7T5+MLqNQPDDyyt4l7KERkoNv80US7FabBM5K fLx4/+XKs1LBlMpZQJ3bSxoJiy3eZc35EJ77Z2u+uA1lD/6DXuzhJx3i/LH4qJyi 7kcc02NPY7E9jnAsDGOhJ4QX60NwRVfb+mtDSJE79soykz03uNazGckKmDswOJ7z hYwb8FhESoQiSTnxICeB4QoBpFUEyrFZIHFaOBB4p7FMZO8aOklU/5+2pBJpL4fw == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrleekgddthecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpeffhffvuffkfhggtggujgesghdtreertddtvdenucfhrhhomheprfgrthhrihgt khcuufhtvghinhhhrghrughtuceophhssehpkhhsrdhimheqnecuggftrfgrthhtvghrnh epheeghfdtfeeuffehkefgffduleffjedthfdvjeektdfhhedvlefgtefgvdettdfhnecu kfhppeejjedrudeluddrvdejrddufedvnecuvehluhhsthgvrhfuihiivgeptdenucfrrg hrrghmpehmrghilhhfrhhomhepphhssehpkhhsrdhimh X-ME-Proxy: Received: from vm-mail.pks.im (x4dbf1b84.dyn.telefonica.de [77.191.27.132]) by mail.messagingengine.com (Postfix) with ESMTPA id 97EF424005B; Mon, 1 Mar 2021 04:43:58 -0500 (EST) Received: from localhost (ncase [10.192.0.11]) by vm-mail.pks.im (OpenSMTPD) with ESMTPSA id 0d355eef (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Mon, 1 Mar 2021 09:43:58 +0000 (UTC) Date: Mon, 1 Mar 2021 10:43:55 +0100 From: Patrick Steinhardt To: git@vger.kernel.org Cc: Jeff King , Yaron Wittenstein , Junio C Hamano Subject: [PATCH v2 2/2] githooks.txt: Clarify documentation on reference-transaction hook Message-ID: <55905b8693dd49637d0516ee123405cbfb58b6c6.1614591751.git.ps@pks.im> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The reference-transaction hook doesn't clearly document its scope and what values it receives as input. Document it to make it less surprising and clearly delimit its (current) scope. Signed-off-by: Patrick Steinhardt --- Documentation/githooks.txt | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Documentation/githooks.txt b/Documentation/githooks.txt index 4dad80052e..b51959ff94 100644 --- a/Documentation/githooks.txt +++ b/Documentation/githooks.txt @@ -473,7 +473,8 @@ reference-transaction This hook is invoked by any Git command that performs reference updates. It executes whenever a reference transaction is prepared, -committed or aborted and may thus get called multiple times. +committed or aborted and may thus get called multiple times. The hook +does not cover symbolic references (but that may change in the future). The hook takes exactly one argument, which is the current state the given reference transaction is in: @@ -492,6 +493,14 @@ receives on standard input a line of the format: SP SP LF +where `` is the old object name passed into the reference +transaction, `` is the new object name to be stored in the +ref and `` is the full name of the ref. When force updating +the reference regardless of its current value or when the reference is +to be created anew, `` is the all-zeroes object name. To +distinguish these cases, you can inspect the current value of +`` via `git rev-parse`. + The exit status of the hook is ignored for any state except for the "prepared" state. In the "prepared" state, a non-zero exit status will cause the transaction to be aborted. The hook will not be called with