]> Sergey Matveev's repositories - sgblog.git/blobdiff - cmd/sgblog/http.go
Manually updated comment objects can not be parsed
[sgblog.git] / cmd / sgblog / http.go
index 85359b3162cab61b643e9741945d475dfff8aeb2..a4ad6713a42d3861a3c4da6d0ec6dcc500448b44 100644 (file)
@@ -473,11 +473,14 @@ func serveHTTP() {
                        commentedHash := plumbing.NewHash(strings.ReplaceAll(
                                fileStats[0].Name, "/", "",
                        ))
-                       comments := parseComments(getNote(t, commentedHash))
                        commit, err = repo.CommitObject(commentedHash)
                        if err != nil {
                                makeErr(err)
                        }
+                       comments := parseComments(getNote(t, commentedHash))
+                       if len(comments) == 0 {
+                               continue
+                       }
                        commentN := strconv.Itoa(len(comments) - 1)
                        lines := strings.Split(comments[len(comments)-1], "\n")
                        from := strings.TrimPrefix(lines[0], "From: ")