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

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

From
Jeff King <peff@peff.net>
Date
Feb 26, 2021, 06:03 UTC
Message-ID
<YDiPP3Ml73igpT7Q@coredump.intra.peff.net>
In-Reply-To
<c30d41de55b8991a09e1d550e853f582b5394dee.1614232040.git.ps@pks.im>
On Thu, Feb 25, 2021 at 06:50:12AM +0100, Patrick Steinhardt wrote:
Show 11 quoted lines
> 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.

I think that's a good step forward. We might want to say "does not cover symbolic references (but that may change in the future)" to make it clear that nothing is definite.

OTOH, I suspect adding them would require a change to the hook's stdin format, so it is not like a hook could be written in a way to magically handle them if things change in the future.

Show 10 quoted lines
> @@ -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`.

We should probably avoid saying "40" here. Maybe "all zeroes" or something.

-Peff
Previous: Patrick SteinhardtNext: Patrick Steinhardt
Message 2 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.