Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for submodules #38

Closed
piotrb opened this issue Aug 1, 2019 · 5 comments
Closed

Support for submodules #38

piotrb opened this issue Aug 1, 2019 · 5 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@piotrb
Copy link

piotrb commented Aug 1, 2019

When running lefthook on a checked out submodule the directory structure is not as expected.

$ lefthook install
SYNCING lefthook.yml
SERVED HOOKS: pre-commit, prepare-commit-msg
open {HOME}/{PROJECT}/{SUBMODULE_NAME}/.git/hooks/pre-commit: not a directory

This is because in a submodule .git is a file with the following content:

gitdir: ../.git/modules/{SUBMODULE_NAME}

It sounds simple enough to have lefthook understand that and just follow that relative path instead and drop the hooks there.

(I did a quick test, that's all that's needed, if you drop the hooks in that folder instead it seems to work as expected)

@Arkweid
Copy link
Collaborator

Arkweid commented Aug 1, 2019

Thank you for issue @piotrb!
Unfortunately, I'm a little busy in the coming days :(
If you have the opportunity to do PR with a correction, this will be great. I will accept it and release with your fix.

@Arkweid Arkweid added enhancement New feature or request help wanted Extra attention is needed labels Aug 1, 2019
@Lighttree
Copy link

Lighttree commented Aug 5, 2019

Hi I have one issue with my project structure.
And I'm not sure is it in scope of this enhancement or not.

I'm trying to migrate JavaScript project from Husky. It has following folder structure:

/ my_project_parent
  / .git
  / my_project
       lefthook.yml
       package.json
       ...
...

The problem is that lefthook looking for .git folder in my_project at the moment, while it is actually in parent folder.

It would be nice if it can find parent .git and write hooks there.

@Arkweid
Copy link
Collaborator

Arkweid commented Aug 5, 2019

Yea, just need to replace calls form getRootDir() to result of that call: git rev-parse --show-toplevel.
In that case GIR_DIR env variable should be supported too.

@lisovskyvlad
Copy link

Would be awesome as next feature!

@Arkweid
Copy link
Collaborator

Arkweid commented Dec 21, 2019

Released in 0.7.0
More info here:
#72

@Arkweid Arkweid closed this as completed Dec 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants