swellaby / rusty-hook

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

Exit gracefully from hook scripts when requisite bins missing #141

Open calebcartwright opened 3 years ago

calebcartwright commented 3 years ago

We're deliberate in the underlying git hook scripts to avoid failing (and thus breaking git flows) in environmental cases, such as a missing configuration file, but there's a big case we've missed entirely

https://github.com/swellaby/rusty-hook/blob/e284e157c71c7a2c99ae790b8d47c1709382ec55/src/hook_files/cli.sh#L47-L57

However, we've overlooked the scenarios where rusty-hook bin is not already on the system and the subsequent cli installation fails, as well as cargo itself not being available. These are not impossible scenarios by any stretch of the imagination, and could occur relatively easily, for example if cargo's bin directory or cargo itself is not on the user's path, and we've had a couple reports (albeit with different causes) of hook issues due to the executables not being found (refs #105 #140).

To prevent this problematic behavior, we should: