@matheusbsbs / matheus-bagliano / commits / d8d3d632f4
Fork 0

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>

Denton Liu committed Sep 23, 2020 at 02:38 UTC d8d3d632f4165955da49032d50279c20cfbde2e5
1 file changed +1 -1
templates/hooks--update.sample
+1 -1
@@ -60,7 +60,7 @@ esac
60
61 # --- Check types
62 # if $newrev is 0000...0000, it's a commit to delete a ref.
63 -zero="0000000000000000000000000000000000000000"
63 +zero=$(git hash-object --stdin </dev/null | tr '[0-9a-f]' '0')
64 if [ "$newrev" = "$zero" ]; then
65 newrev_type=delete
66 else