Skip to content

Commit d8d3d63

Browse files
Denton-Lgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 8c7e505 commit d8d3d63

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

templates/hooks--update.sample

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ esac
6060

6161
# --- Check types
6262
# 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')
6464
if [ "$newrev" = "$zero" ]; then
6565
newrev_type=delete
6666
else

0 commit comments

Comments
 (0)