]> Sergey Matveev's repositories - sgblog.git/blobdiff - cmd/sgblog/topics.go
Unify copyright comment format
[sgblog.git] / cmd / sgblog / topics.go
index 8e34bb43409af0b9350a60434e1ee2b541b43cf4..9308a8a4909923891056547a8e5b7140b3478879 100644 (file)
@@ -1,19 +1,17 @@
-/*
-SGBlog -- Git-backed CGI/inetd blogging/phlogging engine
-Copyright (C) 2020-2021 Sergey Matveev <stargrave@stargrave.org>
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU Affero General Public License as
-published by the Free Software Foundation, version 3 of the License.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU Affero General Public License
-along with this program.  If not, see <http://www.gnu.org/licenses/>.
-*/
+// SGBlog -- Git-backed CGI/UCSPI blogging/phlogging/gemlogging engine
+// Copyright (C) 2020-2024 Sergey Matveev <stargrave@stargrave.org>
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as
+// published by the Free Software Foundation, version 3 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 package main
 
@@ -27,6 +25,7 @@ import (
 
        "github.com/go-git/go-git/v5/plumbing"
        "github.com/go-git/go-git/v5/plumbing/object"
+       "go.stargrave.org/sgblog"
 )
 
 type TopicsCache map[string][]plumbing.Hash
@@ -38,7 +37,7 @@ type TopicsCacheState struct {
 
 func (tc TopicsCache) Topics() []string {
        topics := make([]string, 0, len(tc))
-       for t, _ := range tc {
+       for t := range tc {
                topics = append(topics, t)
        }
        sort.Strings(topics)
@@ -75,7 +74,7 @@ NoCache:
                if err != nil {
                        break
                }
-               for _, topic := range parseTopics(getNote(topicsTree, commit.Hash)) {
+               for _, topic := range sgblog.ParseTopics(sgblog.GetNote(repo, topicsTree, commit.Hash)) {
                        cache[topic] = append(cache[topic], commit.Hash)
                }
        }