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

Compatibility with git worktree #180

Closed
ryuran opened this issue May 6, 2021 · 3 comments · Fixed by #182
Closed

Compatibility with git worktree #180

ryuran opened this issue May 6, 2021 · 3 comments · Fixed by #182
Labels
good first issue Good for newcomers help wanted Extra attention is needed

Comments

@ryuran
Copy link

ryuran commented May 6, 2021

Hello!

Version 7.4.0

I work with git worktree to be able to work simultaneously on different branches of a project.

When I run npx --no-install lefthook install from a worktree, I have this error :

This command must be executed within git repository.
Change working directory or initialize new repository with 'git init'.

In a git worktree, .git is not a directory but a file containing :

gitdir: /path/to/original/directory/.git/worktrees/name-of-the-worktree
@Envek Envek added good first issue Good for newcomers help wanted Extra attention is needed labels May 6, 2021
@Envek
Copy link
Member

Envek commented May 6, 2021

Thanks for reporting this and including details! git worktree apparently is one of the things that we should support.

@Envek
Copy link
Member

Envek commented May 14, 2021

Fix for this has been released in 0.7.5. Enjoy!

@ryuran
Copy link
Author

ryuran commented May 17, 2021

@Envek @skryukov
Thank you.

I still encounter an issue with 0.7.5 in a worktree.

Same error message:

This command must be executed within git repository.
Change working directory or initialize new repository with 'git init'.

Maybe a lead to follow:

  • main directory : lefthook 0.7.4
  • worktree directory : lefthook 0.7.5

It seems to use the lefthook version from the original git directory instead of the local one.
see #192

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants