Skip to content

Commit

Permalink
fix(cli): tweaks for core.commentChar handling (conventional-changelo…
Browse files Browse the repository at this point in the history
…g#3190)

- Remove useless change to test git repository setup
- Add comment on git config error handling
  • Loading branch information
jscheid committed May 23, 2022
1 parent 481478c commit 33be5ab
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 2 additions & 0 deletions @commitlint/cli/src/cli.ts
Expand Up @@ -232,6 +232,8 @@ async function main(args: MainArgs) {
opts.parserOpts.commentChar = stdout.trim() || gitDefaultCommentChar;
} catch (e) {
const execaError = e as ExecaError;
// git config returns exit code 1 when the setting is unset,
// don't warn in this case.
if (!execaError.failed || execaError.exitCode !== 1) {
console.warn(
'Could not determine core.commentChar git configuration',
Expand Down
1 change: 0 additions & 1 deletion @packages/test/src/git.ts
Expand Up @@ -35,7 +35,6 @@ async function setup(cwd: string, gitCommand = 'git') {
cwd,
});
await execa(gitCommand, ['config', 'commit.gpgsign', 'false'], {cwd});
await execa(gitCommand, ['config', 'core.commentChar', '#'], {cwd});
} catch (err: any) {
if (typeof err === 'object' && typeof err.message === 'object') {
console.warn(`git config in ${cwd} failed`, err.message);
Expand Down

0 comments on commit 33be5ab

Please sign in to comment.