alirezanet / Husky.Net

Git hooks made easy with Husky.Net internal task runner! 🐶 It brings the dev-dependency concept to the .NET world!
https://alirezanet.github.io/Husky.Net/
MIT License
632 stars 29 forks source link

RFC: install command with submodule proposals #80

Closed Tychus closed 10 months ago

Tychus commented 10 months ago

RFC for #69

quickly slapped this proposal. Before failing on the .git can't be found we can check if we're inside a submodule.

Option 1 Use the path returned by git to find the main .git and continue with the install normally. we don't attach husky to anything else. This should be enough assuming the .husky is present in the root super project

Option 2 husky install step is in both the submodule and the super project. we check if we're running the submodule target and just break, let the super project target do the install instead.

I believe this should work without breaking existing projects. Will give it a try tomorrow and report back.

Need feedback before working on a final mergeable PR.

alirezanet commented 10 months ago

Hi @Tychus, I think we need to support all three scenarios,

1- husky in both submodule and root super project, 2- husky only in root project 3- husky only in submodule

all three options are valid, but we need to somehow detect what user wants (from the project files or configuration). unfortunately at the moment I don't have time to investigate further but it would be nice if you can check it out. also keep it in mind worktree and submodule need different flows.( #43 is related to worktree.)

Tychus commented 10 months ago

if you can check it out. also keep it in mind worktree and submodule need different flows.

Yup this PR is just to illustrate the proposal.

I think we need to support all three scenarios,

Will have some time later to actually work on a real fix for this.

I'm thinking some parameter is needed here IgnoreSubmodule or something like that, based on which we can either drop the whole install or grab the hooks and set them up up top in the main repo.