swellaby / rusty-hook

git hook manager, geared toward Rust projects
MIT License
205 stars 11 forks source link

Rename existing commit hooks #156

Open nirvdrum opened 2 years ago

nirvdrum commented 2 years ago

Description

When rusty-hook is set up, it generates new git hook files and overwrites any hooks that may exist. Since git doesn't store hook files in its repo, undoing the changes made by rusty-hook generally mean restoring a file from backup. It would be helpful if rusty-hook, instead, renamed existing files (e.g., pre-commit -> pre-commit.bak) before replacing them.

Value

It may turn out that rusty-hook doesn't work well for a certain application. Removing it is a bit more involved now because the original hook files need to be recovered and restored. Even if one is to continue using rusty-hook, it'd be helpful to be able to consult the original hook file to see what additional checks might be enabled.

calebcartwright commented 2 years ago

That's a reasonable ask, thanks for the suggestion! I vaguely remember considering this during the initial implementation but it wasn't a high priority since it's relatively uncommon for folks to have manually-crafted hook files