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