/*
-SGBlog -- Git-based CGI/inetd blogging/phlogging engine
+SGBlog -- Git-backed CGI/inetd blogging/phlogging engine
Copyright (C) 2020 Sergey Matveev <stargrave@stargrave.org>
This program is free software: you can redistribute it and/or modify
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-// Git-based CGI/inetd blogging/phlogging engine
+// Git-backed CGI/inetd blogging/phlogging engine
package main
import (
"bytes"
+ "crypto/sha1"
+ "fmt"
"io/ioutil"
"os"
"regexp"
)
var (
- sha1DigestRe = regexp.MustCompilePOSIX("([0-9a-f]{40,40})")
+ sha1DigestRe = regexp.MustCompilePOSIX(fmt.Sprintf("([0-9a-f]{%d,%d})", sha1.Size*2, sha1.Size*2))
repo *git.Repository
notesTree *object.Tree
+ commentsRef *plumbing.Reference
commentsTree *object.Tree
)
headHash := head.Hash()
if notes, err := repo.Notes(); err == nil {
var notesRef *plumbing.Reference
- var commentsRef *plumbing.Reference
notes.ForEach(func(ref *plumbing.Reference) error {
switch string(ref.Name()) {
case "refs/notes/commits":