On this page
Known content hashes of past pre-push hook versions, so rlsbl can safely overwrite stale hooks without clobbering user-customized scripts.
#rlsbl.hook_hashes
#rlsbl.hook_hashes
Known pre-push hook content hashes used to safely regenerate .git/hooks/pre-push only when its current content matches a previously-shipped rlsbl version, never overwriting user customizations.
rlsbl installs a .git/hooks/pre-push hook in scaffolded projects. The hook content has changed over time (older versions were 44-line standalone bash scripts; the current version is a 2-line dispatcher to rlsbl pre-push-check).
To safely upgrade an old hook without clobbering a user-customized one, we compare its content hash against the set of every hook version rlsbl has shipped. If it matches one of ours, we overwrite. If not, we leave it alone and show the user a diff so they can decide what to do.
#compute_hook_hash
def compute_hook_hash(content)Return the SHA-256 hex digest of content, with trailing whitespace stripped.
Trailing whitespace (including newlines) is stripped before hashing so that a hook re-saved by an editor with a tweaked trailing newline still matches.