rhysd / cargo-husky

Setup Git hooks automatically for cargo projects with :dog:
https://crates.io/crates/cargo-husky
MIT License
325 stars 20 forks source link

What if Cargo.toml is not at the repo root? #28

Open rodya-mirov opened 3 years ago

rodya-mirov commented 3 years ago

In my situation, the repo looks like:

./my-rust-project
./my-rust-project/Cargo.toml
./my-rust-project/src
./other-stuff
./more

I want to use cargo-husky for this, but the pre-built hooks don't work (they need to cd to the Cargo root, which they don't do) and user-scripts are kind of janky (hard to update). This seems like a reasonable use case for cargo-husky, and I wonder if I'm holding it wrong / this would be a feature extension.

If this is unsupported, but seems like a simple extension you would support, I'm also happy to try and take care of it myself with some help.

bbarker commented 3 years ago

I too have this issue currently. Quick workaround that may or may not work for you:

$ ln -s path/to/src src
$ ln -s path/to/Cargo.toml
$ ln -s path/to/Cargo.lock
$ ln -s path/to/target

Check in the sym links and then it should work. And once this is fixed, it should be easy enough to revert that commit.