MCPcopy Index your code
hub / github.com/google/go-github / createSignatureMessage

Function createSignatureMessage

github/git_commits.go:197–224  ·  view source on GitHub ↗
(commit *createCommit)

Source from the content-addressed store, hash-verified

195}
196
197func createSignatureMessage(commit *createCommit) (string, error) {
198 if commit == nil || commit.Message == nil || *commit.Message == "" || commit.Author == nil {
199 return "", errors.New("createSignatureMessage: invalid parameters")
200 }
201
202 var message []string
203
204 if commit.Tree != nil {
205 message = append(message, fmt.Sprintf("tree %v", *commit.Tree))
206 }
207
208 for _, parent := range commit.Parents {
209 message = append(message, fmt.Sprintf("parent %v", parent))
210 }
211
212 message = append(message, fmt.Sprintf("author %v <%v> %v %v", commit.Author.GetName(), commit.Author.GetEmail(), commit.Author.GetDate().Unix(), commit.Author.GetDate().Format("-0700")))
213
214 committer := commit.Committer
215 if committer == nil {
216 committer = commit.Author
217 }
218
219 // There needs to be a double newline after committer
220 message = append(message, fmt.Sprintf("committer %v <%v> %v %v\n", committer.GetName(), committer.GetEmail(), committer.GetDate().Unix(), committer.GetDate().Format("-0700")))
221 message = append(message, *commit.Message)
222
223 return strings.Join(message, "\n"), nil
224}

Calls 3

GetNameMethod · 0.45
GetEmailMethod · 0.45
GetDateMethod · 0.45

Used in the wild real call sites across dependent graphs

searching dependent graphs…