In git submodules .git is a file pointing to the "real" git-dir instead of a directory.
The current implementation of getClosestGitPath does not take this case into account and the githooks --install command fails.
One possible solution is to use git rev-parse --git-dir to get the git directory for the cwd. I implemented that solution naively in my fork: https://github.com/Kampfgnom/git-hooks-js
The problem is: The tests expect a broken implementation and no longer pass with the given solution.
In the context of my current project I do not have the time to investigate any further and fix the issue, which is why I am posting my fork "as is".
In git submodules
.git
is a file pointing to the "real" git-dir instead of a directory.The current implementation of getClosestGitPath does not take this case into account and the
githooks --install
command fails.One possible solution is to use
git rev-parse --git-dir
to get the git directory for the cwd. I implemented that solution naively in my fork: https://github.com/Kampfgnom/git-hooks-jsThe problem is: The tests expect a broken implementation and no longer pass with the given solution.
In the context of my current project I do not have the time to investigate any further and fix the issue, which is why I am posting my fork "as is".