MCPcopy Create free account
hub / github.com/conventional-changelog/commitlint / getGitCommentString

Function getGitCommentString

@commitlint/cli/src/cli.ts:469–489  ·  view source on GitHub ↗
(cwd: string)

Source from the content-addressed store, hash-verified

467// For "auto", git picks "#" unless a message line already starts with it.
468// We always use "#" here (git removes auto in 3.0).
469async function getGitCommentString(cwd: string): Promise<string> {
470 const result = x("git", ["config", "--get-regexp", "^core\\.comment(char|string)$"], {
471 nodeOptions: { cwd },
472 });
473 const output = await result;
474
475 if (result.exitCode && result.exitCode > 1) {
476 console.warn(
477 "Could not determine core.commentChar/core.commentString git configuration",
478 output.stderr,
479 );
480 return gitDefaultCommentChar;
481 }
482
483 const value = output.stdout
484 .split("\n")
485 .filter(Boolean)
486 .pop()
487 ?.replace(/^\S+ ?/, "");
488 return !value || value.toLowerCase() === "auto" ? gitDefaultCommentChar : value;
489}
490
491function getEditValue(flags: CliFlags) {
492 if (flags.env) {

Callers 1

mainFunction · 0.85

Calls 1

filterMethod · 0.80

Tested by

no test coverage detected