git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Patrick Steinhardt <ps@pks.im>
To: Jeff King <peff@peff.net>
Cc: git@vger.kernel.org,
	Yaron Wittenstein <yaron.wittenstein@gmail.com>,
	Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH] githooks.txt: Clarify documentation on reference-transaction hook
Date: Mon, 1 Mar 2021 10:33:24 +0100	[thread overview]
Message-ID: <YDy05NMxhfSKbGtS@ncase> (raw)
In-Reply-To: <YDiPP3Ml73igpT7Q@coredump.intra.peff.net>

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

On Fri, Feb 26, 2021 at 01:03:43AM -0500, Jeff King wrote:
> On Thu, Feb 25, 2021 at 06:50:12AM +0100, Patrick Steinhardt wrote:
> 
> > 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.

Fair, I'll add that.

> 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.

Yeah. Hindsight is 20/20, but this should've used some kind of prefix
with the explicitly stated hint that additional prefixed can be added in
the future. I've got myself to blame for that, I should've known better
to make this more readily extensible.

> > @@ -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

I wasn't completely sure how to word this and thus opted to do the same
as the other hooks. Most notably, both pre-push and pre-receive hook
explicitly call out SHA-1 and the 40-character thingy.

Maybe I'll just add a patch on top to also change those to instead say
"the all-zero object ID" or something similar.

Patrick

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

  reply	other threads:[~2021-03-01  9:34 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 [this message]
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

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=YDy05NMxhfSKbGtS@ncase \
    --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.
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).