]> git.ipfire.org Git - thirdparty/git.git/blobdiff - templates/hooks--pre-push.sample
hooks--pre-push.sample: use hash-agnostic zero OID
[thirdparty/git.git] / templates / hooks--pre-push.sample
index d0f30190acf4037982d1b07ca6f1b964e369782e..4ce688d32b7532862767345f2b991ae856f7d4a8 100755 (executable)
 remote="$1"
 url="$2"
 
-z40=0000000000000000000000000000000000000000
+zero=$(git hash-object --stdin </dev/null | tr '[0-9a-f]' '0')
 
 while read local_ref local_oid remote_ref remote_oid
 do
-       if test "$local_oid" = $z40
+       if test "$local_oid" = "$zero"
        then
                # Handle delete
                :
        else
-               if test "$remote_oid" = $z40
+               if test "$remote_oid" = "$zero"
                then
                        # New branch, examine all commits
                        range="$local_oid"