summaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
authorDenton Liu <liu.denton@gmail.com>2020-09-23 09:38:45 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-09-23 16:31:45 (GMT)
commitd8d3d632f4165955da49032d50279c20cfbde2e5 (patch)
treef206f463125c801a970ba2c0796a4f2e5bb461da /templates
parent8c7e5059506c6840bfbd4dd8d1730784a5689719 (diff)
downloadgit-d8d3d632f4165955da49032d50279c20cfbde2e5.zip
git-d8d3d632f4165955da49032d50279c20cfbde2e5.tar.gz
git-d8d3d632f4165955da49032d50279c20cfbde2e5.tar.bz2
hooks--update.sample: use hash-agnostic zero OID
The update sample hook has the zero OID hardcoded as 40 zeros. However, with the introduction of SHA-256 support, this assumption no longer holds true. Replace the hardcoded $z40 with a call to git hash-object --stdin </dev/null | tr '[0-9a-f]' '0' so the sample hook becomes hash-agnostic. Signed-off-by: Denton Liu <liu.denton@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'templates')
-rwxr-xr-xtemplates/hooks--update.sample2
1 files changed, 1 insertions, 1 deletions
diff --git a/templates/hooks--update.sample b/templates/hooks--update.sample
index 5014c4b..c4d426b 100755
--- a/templates/hooks--update.sample
+++ b/templates/hooks--update.sample
@@ -60,7 +60,7 @@ esac
# --- Check types
# if $newrev is 0000...0000, it's a commit to delete a ref.
-zero="0000000000000000000000000000000000000000"
+zero=$(git hash-object --stdin </dev/null | tr '[0-9a-f]' '0')
if [ "$newrev" = "$zero" ]; then
newrev_type=delete
else