git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2 2/2] githooks.txt: Clarify documentation on reference-transaction hook

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 1, 2021, 16:54 UTC
Message-ID
<xmqqo8g2stl4.fsf@gitster.c.googlers.com>
In-Reply-To
<55905b8693dd49637d0516ee123405cbfb58b6c6.1614591751.git.ps@pks.im>
Patrick Steinhardt <ps@pks.im> writes:
> 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.

Sounds good (especially "that may change in the future" part is a nice touch).

Thanks.
Show 34 quoted lines
> 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
Previous: Patrick Steinhardt
Message 7 of 7 in “githooks.txt: Clarify documentation on reference-transaction hook”
  1. githooks.txt: Clarify documentation on reference-transaction hookPatrick Steinhardt, Feb 25, 2021
  2. Jeff KingFeb 26, 2021
  3. Patrick SteinhardtMar 1, 2021
  4. 1/2 githooks.txt: Replace mentions of SHA-1 specific propertiesPatrick Steinhardt, Mar 1, 2021
  5. Junio C HamanoMar 1, 2021
  6. 2/2 githooks.txt: Clarify documentation on reference-transaction hookPatrick Steinhardt, Mar 1, 2021
  7. Junio C HamanoMar 1, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.