Skip to main content

install_pre_commit_hook

Function install_pre_commit_hook 

Source
pub fn install_pre_commit_hook(
    repo_root: &Path,
) -> Result<InstallHookResult, Box<dyn Error>>
Expand description

Install a pre-commit git hook under repo_root/.git/hooks/.

repo_root must contain a .git directory (worktrees, whose .git is a file, are not supported in v0.3). The .git/hooks/ directory is created if missing. If a pre-commit hook is already present it is left untouched and AlreadyExists is returned — the caller is expected to surface that to the user and exit non-zero.