feat: add support for git submodules#469
Merged
marionebl merged 2 commits intoconventional-changelog:masterfrom Jan 27, 2019
ericcornelissen:feat/448-support-submodules
Merged
feat: add support for git submodules#469marionebl merged 2 commits intoconventional-changelog:masterfrom ericcornelissen:feat/448-support-submodules
marionebl merged 2 commits intoconventional-changelog:masterfrom
ericcornelissen:feat/448-support-submodules
Conversation
No test included in this commit as this would require an update to @commitlint/test to support submodules.
iplaces
reviewed
Oct 24, 2018
because `path.resolve` should always be used for relative paths.
Contributor
|
Thanks for the PR @ericcornelissen! Could you provide us with a minimal test case you used to implement this? I'd like to include it as a fixture/test pair for the cli package. |
Contributor
Author
|
I'm unsure what you mean @marionebl, in the PR description I outlined how it has been tested. If you need more detail, the test scenario I added is "get edit commit message from git submodule" which requires the function submodule in @commitlint/test. What the test scenario does in plain English is:
Does that help? |
marionebl
approved these changes
Jan 27, 2019
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
.gitfolder.Description
I updated the read module to determine if it is running from a git sub module or not and find the
COMMIT_EDITMSGaccordingly. It still useseditargument if present, otherwise it looks at.gitand checks whether it is a directory (if it is, look for theCOMMIT_EDITMSGas before) or a file, in which case it reads the file to figure out where theCOMMIT_EDITMSGcan 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
githelper 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: