mbox series

[0/4] sample hooks: become hash agnostic

Message ID cover.1600427894.git.liu.denton@gmail.com (mailing list archive)
Headers show
Series sample hooks: become hash agnostic | expand

Message

Denton Liu Sept. 18, 2020, 11:19 a.m. UTC
There are currently two hooks that have hardcoded 40 zeros as the null
OID and, thus, are not hash-agnostic. Rewrite these to use the newly
introduced `git rev-parse --null-oid` so that they become hash-agnostic.

Denton Liu (4):
  hooks--pre-push.sample: prefer $() for command substitution
  builtin/rev-parse: learn --null-oid
  hooks--pre-push.sample: use hash-agnostic null OID
  hooks--update.sample: use hash-agnostic null OID

 Documentation/git-rev-parse.txt  | 4 ++++
 builtin/rev-parse.c              | 4 ++++
 t/t1500-rev-parse.sh             | 6 ++++++
 templates/hooks--pre-push.sample | 8 ++++----
 templates/hooks--update.sample   | 2 +-
 5 files changed, 19 insertions(+), 5 deletions(-)

Comments

brian m. carlson Sept. 18, 2020, 9:35 p.m. UTC | #1
On 2020-09-18 at 11:19:01, Denton Liu wrote:
> There are currently two hooks that have hardcoded 40 zeros as the null
> OID and, thus, are not hash-agnostic. Rewrite these to use the newly
> introduced `git rev-parse --null-oid` so that they become hash-agnostic.

I've looked over this series and I fully agree that the scripts should
be hash agnostic.  I offered an alternative which you may find simpler
and more appealing (or not), but with the constraint that if we add
--null-oid, it should accept an argument, I have no comments beyond what
other folks have added.