swellaby / rusty-hook

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

Installs git hook even when rusty-hook command is not available #140

Open kornelski opened 3 years ago

kornelski commented 3 years ago

I'm not a rusty-hook user, I've only built someone else's crate that has rusty-hook as a dependency, and it broke my git repository by adding pre-commit hooks that expect rusty-hook command in PATH. I don't have one, so I can't commit.

Please try to detect whether rusty-hook is installed and is going to work as a pre-commit hook before modifying git repos.

kornelski commented 3 years ago

Also, rusty-hook has modified the wrong repository. I have a Cargo workspace like this:

.git # this got modified :(
Cargo.toml # not using rusty-hook
git-submodule-third-party-crate/
   .git # this should have been modified, if any
   Cargo.toml # uses rusty-hook
calebcartwright commented 3 years ago

Thanks for reaching out. Could you answer two questions for us so that we have a better understanding of the circumstances and are better able to troubleshoot:

kornelski commented 3 years ago

Thank you for checking it out.

The submodule has:

[dev-dependencies]
rusty-hook = "^0.10.1" # v0.10.3

I do have .cargo/bin in PATH, and I don't have rusty-hook binary installed anywhere.

calebcartwright commented 3 years ago

Interesting :thinking:. The hook scripts will also perform bootstrapping if necessary, including the CLI which should have resulted in the executable existing under the cargo bin directory.

Was there any output in your terminal from running the git command that triggered the first hook you could share?

Also, totally understood if you already have (or want to) nuke the hook files in the .git/hooks directory to get things sorted again in your local workspace, we can attempt to reproduce on our end.