Skip to main content

remove_git_hook

Function remove_git_hook 

Source
pub fn remove_git_hook(hook_file: &Path) -> Result<bool, CliError>
Expand description

Take the sync block back out of hook_file. Returns whether anything changed.

The file itself is deleted only when nothing but an interpreter line is left, which is exactly the state a hook we created is in — a hook the user wrote has their lines in it and is rewritten rather than removed. An empty stub of theirs would be deleted too, which git cannot tell apart from the stub never having existed.

An unterminated block is an error and the file is left alone; see [strip_hook_block].