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

Function EmptyCommit

repo/commit.go:62–94  ·  view source on GitHub ↗

EmptyCommit simply create an empty commit

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

Source from the content-addressed store, hash-verified

60
61// EmptyCommit simply create an empty commit
62func EmptyCommit(
63 ctx context.Context,
64 msg string,
65 noVerify bool,
66 authorName, authorEmail string,
67) *exec.Cmd {
68 if msg == "" {
69 msg = defaultCommitMessage
70 }
71
72 cmd := exec.CommandContext(
73 ctx,
74 "git",
75 "commit",
76 "--allow-empty",
77 "-m",
78 msg,
79 )
80
81 if noVerify {
82 cmd.Args = append(
83 cmd.Args,
84 "--no-verify")
85 }
86
87 if authorName != "" || authorEmail != "" {
88 cmd.Args = append(
89 cmd.Args,
90 fmt.Sprintf("--author=\"%s <%q>\"", authorName, authorEmail))
91 }
92
93 return cmd
94}
95
96// ForceCommit commits every change while skipping CI.
97func ForceCommit(

Callers 1

HandleCommitMethod · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected