When working with git submodules, commitlint cannot find the COMMIT_EDITMSG file for the submodule and you get an error (see below for details).
Expected Behavior
Commitlint should look for the COMMIT_EDITMSG file located in the parents .git folder.
Current Behavior
Commitlint errors with the following error:
Error: ENOENT: no such file or directory, open 'D:\Workspace\Demeter\modules\template-parser\.git\COMMIT_EDITMSG'
Affected packages
Possible Solution
Somehow check if the current repository is a submodule and if that is the case look at the .git folder of the parent repository instead. The parents .git folder can be found in the .git file of the submodule.
Steps to Reproduce (for bugs)
- Create a git repository
- Add a submodule to the git repository created in step 1.
- Make sure the submodule uses commitlint.
- Try to lint the commit message for a commit in the submodule.
commitlint.config.js (of the submodule)
```js
module.exports = {
extends: ['@commitlint/config-conventional']
};
```
Context
I'm basically just trying to use commitlint in a project where I'm using submodules...
Your Environment
| Executable |
Version |
commitlint --version |
7.1.0 |
git --version |
git version 2.6.1.windows.1 |
node --version |
v8.3.0 |
When working with git submodules, commitlint cannot find the
COMMIT_EDITMSGfile for the submodule and you get an error (see below for details).Expected Behavior
Commitlint should look for the
COMMIT_EDITMSGfile located in the parents.gitfolder.Current Behavior
Commitlint errors with the following error:
Affected packages
Possible Solution
Somehow check if the current repository is a submodule and if that is the case look at the
.gitfolder of the parent repository instead. The parents.gitfolder can be found in the.gitfile of the submodule.Steps to Reproduce (for bugs)
commitlint.config.js (of the submodule)
```js module.exports = { extends: ['@commitlint/config-conventional'] }; ```Context
I'm basically just trying to use commitlint in a project where I'm using submodules...
Your Environment
commitlint --versiongit --versionnode --version