All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrick Steinhardt <ps@pks.im>
To: git@vger.kernel.org
Cc: Jeff King <peff@peff.net>,
	Yaron Wittenstein <yaron.wittenstein@gmail.com>,
	Junio C Hamano <gitster@pobox.com>
Subject: [PATCH v2 2/2] githooks.txt: Clarify documentation on reference-transaction hook
Date: Mon, 1 Mar 2021 10:43:55 +0100	[thread overview]
Message-ID: <55905b8693dd49637d0516ee123405cbfb58b6c6.1614591751.git.ps@pks.im> (raw)
In-Reply-To: <c30d41de55b8991a09e1d550e853f582b5394dee.1614232040.git.ps@pks.im>

[-- Attachment #1: Type: text/plain, Size: 1830 bytes --]

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 <ps@pks.im>
---
 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:
 
   <old-value> SP <new-value> SP <ref-name> LF
 
+where `<old-value>` is the old object name passed into the reference
+transaction, `<new-value>` is the new object name to be stored in the
+ref and `<ref-name>` 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, `<old-value>` is the all-zeroes object name. To
+distinguish these cases, you can inspect the current value of
+`<ref-name>` 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
-- 
2.30.1


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  parent reply	other threads:[~2021-03-01  9:45 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-25  5:50 [PATCH] githooks.txt: Clarify documentation on reference-transaction hook Patrick Steinhardt
2021-02-26  6:03 ` Jeff King
2021-03-01  9:33   ` Patrick Steinhardt
2021-03-01  9:43 ` [PATCH v2 1/2] githooks.txt: Replace mentions of SHA-1 specific properties Patrick Steinhardt
2021-03-01 16:48   ` Junio C Hamano
2021-03-01  9:43 ` Patrick Steinhardt [this message]
2021-03-01 16:54   ` [PATCH v2 2/2] githooks.txt: Clarify documentation on reference-transaction hook Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55905b8693dd49637d0516ee123405cbfb58b6c6.1614591751.git.ps@pks.im \
    --to=ps@pks.im \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=peff@peff.net \
    --cc=yaron.wittenstein@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.