MCPcopy Create free account
hub / github.com/appleboy/drone-git-push / ForceCommit

Function ForceCommit

repo/commit.go:97–128  ·  view source on GitHub ↗

ForceCommit commits every change while skipping CI.

(
	ctx context.Context,
	msg string,
	noVerify bool,
	authorName, authorEmail string,
)

Source from the content-addressed store, hash-verified

95
96// ForceCommit commits every change while skipping CI.
97func ForceCommit(
98 ctx context.Context,
99 msg string,
100 noVerify bool,
101 authorName, authorEmail string,
102) *exec.Cmd {
103 if msg == "" {
104 msg = defaultCommitMessage
105 }
106
107 cmd := exec.CommandContext(
108 ctx,
109 "git",
110 "commit",
111 "-m",
112 msg,
113 )
114
115 if noVerify {
116 cmd.Args = append(
117 cmd.Args,
118 "--no-verify")
119 }
120
121 if authorName != "" || authorEmail != "" {
122 cmd.Args = append(
123 cmd.Args,
124 fmt.Sprintf("--author=\"%s <%s>\"", authorName, authorEmail))
125 }
126
127 return cmd
128}

Callers 1

HandleCommitMethod · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected