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
|
if [ ${rustyHookExitCode} -eq ${noConfigFileExitCode} ]; then |
|
if [ "${hookName}" = "pre-commit" ]; then |
|
echo "[rusty-hook] rusty-hook git hooks are configured, but no config file was found" |
|
echo "[rusty-hook] In order to use rusty-hook, your project must have a config file" |
|
echo "[rusty-hook] See https://github.com/swellaby/rusty-hook#configure for more information about configuring rusty-hook" |
|
echo |
|
echo "[rusty-hook] If you were trying to remove rusty-hook, then you should also delete the git hook files to remove this warning" |
|
echo "[rusty-hook] See https://github.com/swellaby/rusty-hook#removing-rusty-hook for more information about removing rusty-hook from your project" |
|
echo |
|
fi |
|
exit 0 |
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:
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
rusty-hook/src/hook_files/cli.sh
Lines 47 to 57 in e284e15
However, we've overlooked the scenarios where
rusty-hookbin is not already on the system and the subsequent cli installation fails, as well ascargoitself 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:
cargoavailability before attempting to use it and exit with a message should it not be (https://github.com/swellaby/rusty-hook/blob/master/src/hook_files/cli.sh)rusty-hookavailability/installation success instead of just assuming the install succeeded and is available in cases where it wasn't already on thte systemhttps://github.com/swellaby/rusty-hook/blob/master/src/hook_files/hook_script.sh#L13