git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] githooks.txt: Clarify documentation on reference-transaction hook
@ 2021-02-25  5:50 Patrick Steinhardt
  2021-02-26  6:03 ` Jeff King
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Patrick Steinhardt @ 2021-02-25  5:50 UTC (permalink / raw)
  To: git; +Cc: Jeff King, Yaron Wittenstein, Junio C Hamano

[-- Attachment #1: Type: text/plain, Size: 2067 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>
---

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:
 
   <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 40 `0`. 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 --]

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-03-01 17:00 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [PATCH v2 2/2] githooks.txt: Clarify documentation on reference-transaction hook Patrick Steinhardt
2021-03-01 16:54   ` Junio C Hamano

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).