diff --git a/@commitlint/cli/src/cli.ts b/@commitlint/cli/src/cli.ts index a4074fe37d..4f9fd5bd21 100644 --- a/@commitlint/cli/src/cli.ts +++ b/@commitlint/cli/src/cli.ts @@ -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', diff --git a/@packages/test/src/git.ts b/@packages/test/src/git.ts index d0acb9d86f..e0ba9f7dbd 100644 --- a/@packages/test/src/git.ts +++ b/@packages/test/src/git.ts @@ -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);