feat: add support for git submodules #469
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Implements build-in support for linting the commits of git sub modules, which currently doesn't work because sub modules don't have their own
.git
folder.Description
I updated the read module to determine if it is running from a git sub module or not and find the
COMMIT_EDITMSG
accordingly. It still usesedit
argument if present, otherwise it looks at.git
and checks whether it is a directory (if it is, look for theCOMMIT_EDITMSG
as before) or a file, in which case it reads the file to figure out where theCOMMIT_EDITMSG
can be found.Comments on my implementation are welcome, I'm happy to change it if needed 🙂
Motivation and Context
This change is required in order to support linting the commits of git sub modules.
Fixes #448
Usage examples
n/a
How Has This Been Tested?
Tests are missing from this PR (at least for now) as it requires an update to the @commitlint/test package (support for sub modules in the
git
helper has to be added). However, I did create a test locally with a rough outline of what the update to the @commitlint/test might look like. You can find the required changes in this gist, simply checkout on this branch and replace the local files with the two in the gist and you can test the new feature.The reason I opened this PR first is because I wanted to be sure this would be included before updating the @commitlint/test code and adding something that wasn't really needed...
Types of changes
Checklist: