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

Does not find correct root. #150

Open
nvasilakis opened this issue Jul 5, 2020 · 1 comment · May be fixed by #151
Open

Does not find correct root. #150

nvasilakis opened this issue Jul 5, 2020 · 1 comment · May be fixed by #151

Comments

@nvasilakis
Copy link

Hi — thanks for this package.

It turns out it does not work if the directory structure is not the one assumed by pre-commit. Specifically, it seems to assume that git root is path.resolve(__dirname, '..', '..') which might not be the case (as it happens in our setup). A safer way to get the root would be git rev-parse --show-toplevel. If folks agree, I can submit a pull request.

(A smaller, but related, problem is that the install.js script fails silently in this case — i.e., without providing any feedback on where to start from. Without any message, just the effort of understanding how pre-commit works to fix this problem might be more than the effort of just setting the pre-commit hook manually; thus, adding a short message would bring significant benefits.)

@nvasilakis
Copy link
Author

It turns out that he master branch is behind the one published on npm. I run version ^1.2.2, but when cloning to fix, I see someone has already added code that is not reflected on npm — it's still not the full solution, but it does include a nice error message.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant