secret-shield
secret-shield copied to clipboard
Add repository-local fallback checks for all hooks
Git offers many different hooks. secret-shield
implements only one of them (pre-commit
), but it sets core.hooksPath
to its hooks
directory as per the recommended installation procedure.
Unfortunately, this precludes other hooks (like pre-push
) from running altogether, since git
only looks in secret-shield
s hook directory.
This PR creates a common execute_hook.sh
function and symlinks all hooks to it. This file checks whether the local directory has a hook with that name and executes it instead, much like the pre-commit
has done before. Additionally, it also forwards all arguments so that local hooks receive the correct input.
If there's no repository-local hook, it tries to execute secret-shield
s hook (stored in a .local
file).
bump