Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use core.commentChar from git config with --edit flag #3191

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 1 addition & 2 deletions @commitlint/cli/src/cli.test.ts
Expand Up @@ -352,7 +352,7 @@ test("it doesn't use parserOpts.commentChar when using edit mode", async () => {

test('it uses core.commentChar git config when using edit mode', async () => {
const cwd = await gitBootstrap('fixtures/comment-char');
await execa('git', ['config', 'core.commentChar', '$'], {cwd});
await execa('git', ['config', '--local', 'core.commentChar', '$'], {cwd});
await fs.writeFile(
path.join(cwd, '.git', 'COMMIT_EDITMSG'),
'header: foo\n\n$body\n'
Expand All @@ -365,7 +365,6 @@ test('it uses core.commentChar git config when using edit mode', async () => {

test('it falls back to # for core.commentChar when using edit mode', async () => {
const cwd = await gitBootstrap('fixtures/comment-char');
await execa('git', ['config', '--unset', 'core.commentChar'], {cwd});
await fs.writeFile(
path.join(cwd, '.git', 'COMMIT_EDITMSG'),
'header: foo\n\n#body\n'
Expand Down
6 changes: 3 additions & 3 deletions package.json
Expand Up @@ -19,8 +19,8 @@
"publish": "lerna publish --conventional-commits",
"reinstall": "yarn clean && yarn install",
"start": "yarn watch",
"test": "jest",
"test-ci": "jest --runInBand",
"test": "HOME=$PWD jest",
escapedcat marked this conversation as resolved.
Show resolved Hide resolved
"test-ci": "HOME=$PWD jest --runInBand",
jscheid marked this conversation as resolved.
Show resolved Hide resolved
"postinstall": "yarn husky install"
},
"commitlint": {
Expand Down Expand Up @@ -106,4 +106,4 @@
"resolutions": {
"**/lodash": "^4.17.19"
}
}
}