MCPcopy Create free account
hub / github.com/lerna/lerna / gitCommit

Function gitCommit

libs/commands/version/src/lib/git-commit.ts:15–56  ·  view source on GitHub ↗
(
  message: string,
  { amend, commitHooks, signGitCommit, signoffGitCommit, overrideMessage }: GitCommitOptions,
  opts: ExecOptions
)

Source from the content-addressed store, hash-verified

13}
14
15export function gitCommit(
16 message: string,
17 { amend, commitHooks, signGitCommit, signoffGitCommit, overrideMessage }: GitCommitOptions,
18 opts: ExecOptions
19) {
20 log.silly("gitCommit", message);
21 const args = ["commit"];
22
23 if (commitHooks === false) {
24 args.push("--no-verify");
25 }
26
27 if (signGitCommit) {
28 args.push("--gpg-sign");
29 }
30
31 if (signoffGitCommit) {
32 args.push("--signoff");
33 }
34
35 const shouldChangeMessage = amend ? amend && overrideMessage : true;
36 if (amend) {
37 args.push("--amend");
38 }
39
40 if (shouldChangeMessage) {
41 if (message.indexOf(EOL) > -1) {
42 // Use tempfile to allow multi\nline strings.
43 args.push("-F", tempWrite.sync(message, "lerna-commit.txt"));
44 } else {
45 args.push("-m", message);
46 }
47 } else {
48 args.push("--no-edit");
49 }
50
51 // TODO: refactor to address type issues
52 // eslint-disable-next-line @typescript-eslint/ban-ts-comment
53 // @ts-ignore
54 log.verbose("git", args);
55 return childProcess.exec("git", args, opts as any);
56}

Callers 3

git-commit.spec.tsFile · 0.90

Calls 1

execMethod · 0.80

Tested by

no test coverage detected