ParseAllValid takes collection of git notes and tries to parse a review comment from each one. Any notes that are not valid review comments get ignored, as we expect the git notes to be a heterogenous list, with only some of them being review comments.
(notes []repository.Note)
| 147 | // ignored, as we expect the git notes to be a heterogenous list, with only |
| 148 | // some of them being review comments. |
| 149 | func ParseAllValid(notes []repository.Note) map[string]Comment { |
| 150 | comments := make(map[string]Comment) |
| 151 | for _, note := range notes { |
| 152 | comment, err := Parse(note) |
| 153 | if err == nil && comment.Version == FormatVersion { |
| 154 | hash, err := comment.Hash() |
| 155 | if err == nil { |
| 156 | comments[hash] = comment |
| 157 | } |
| 158 | } |
| 159 | } |
| 160 | return comments |
| 161 | } |
| 162 | |
| 163 | func (comment Comment) serialize() ([]byte, error) { |
| 164 | if len(comment.Timestamp) < 10 { |