Skip to content

commitlint not working for git submodules #448

Closed
@ericcornelissen

Description

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

  • cli
  • core
  • prompt
  • config-angular

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)

  1. Create a git repository
  2. Add a submodule to the git repository created in step 1.
  3. Make sure the submodule uses commitlint.
  4. 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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions