(commit *createCommit)
| 195 | } |
| 196 | |
| 197 | func 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 | } |
searching dependent graphs…