Skip to content

[cli strategies] The current working directory is not exactly equal to the git root path #677

@shixy96

Description

@shixy96

When the current project is a subproject of the repository, the current working directory is not the root of the git repository. And this will cause the git-cz commit operation caused by the husky hook to fail.

(node:15426) UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, open '/Users/repository/sub/.git/COMMIT_EDITMSG'
    at openSync (fs.js:451:3)
    at commit (/Users/repository/sub/node_modules/commitizen/dist/git/commit.js:844:62)
    at dispatchGitCommit (/Users/repository/sub/node_modules/commitizen/dist/commitizen/commit.js:545:19)
    at /Users/repository/sub/node_modules/commitizen/dist/commitizen/commit.js:628:11
    at /Users/repository/sub/node_modules/cz-conventional-changelog/engine.js:216:9
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
(node:15426) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:15426) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

This problem is very similar to #187 。By the way, the document was not updated with the bug fixed.
image
I created a pull request for this problem #676 .

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions