You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Overriding config.commitizen.path to the plain npm module name cz-conventional-changelog (as per #469) is sufficient to get npx git cz working, BUT...
Problem:
Trying to use the husky hook (which is from the README) will throw:
myGitRepo/source $ git commit
# (Prompting works fine, but then...)
Error: ENOENT: no such file or directory, open '/myCoolParentFolder/myGitRepo/source/.git/COMMIT_EDITMSG
Note that it's always taking the package.json folder, not the current working directory e.g:
myGitRepo/source/packages $ git commit
# (Also prompts fine, but tries to write to same wrong .git folder...)
Error: ENOENT: no such file or directory, open '/myCoolParentFolder/myGitRepo/source/.git/COMMIT_EDITMSG
It doesn't seem to be possible to override via environment variables (e.g. by messing with GIT_DIR in the husky hook statement like they do here or here), because cli/strategies/git-cz.js explicitly calls commitizen.commit with repoPath = process.cwd():
This issue only affects running in hook mode, because in standard git cz we just pass the message through as an argument to a spawned git process, which manages to figure out that it's in a subfolder of a repository.
Fix Investigation:
I had a look around to try and figure what a fix might look like, but I don't really understand why cliPath and repoPath are tracked as separate variables when the CLI strategy seems to just force repoPath to the package root?
The text was updated successfully, but these errors were encountered:
Hello, I have encountered this issue, too. And it seems that there is a PR to fix this issue. Why that PR is not merged yet? Is there anything we can do fix this issue? Thanks.
Scenario:
Everything Node.JS lives within a subfolder e.g myGitRepo/source/package.json:
Overriding
config.commitizen.path
to the plain npm module namecz-conventional-changelog
(as per #469) is sufficient to getnpx git cz
working, BUT...Problem:
Trying to use the husky hook (which is from the README) will throw:
Note that it's always taking the package.json folder, not the current working directory e.g:
It doesn't seem to be possible to override via environment variables (e.g. by messing with
GIT_DIR
in the husky hook statement like they do here or here), because cli/strategies/git-cz.js explicitly callscommitizen.commit
withrepoPath = process.cwd()
:...and git/commit.js uses that repoPath to store the captured message:
This issue only affects running in hook mode, because in standard
git cz
we just pass the message through as an argument to a spawned git process, which manages to figure out that it's in a subfolder of a repository.Fix Investigation:
I had a look around to try and figure what a fix might look like, but I don't really understand why
cliPath
andrepoPath
are tracked as separate variables when the CLI strategy seems to just forcerepoPath
to the package root?The text was updated successfully, but these errors were encountered: