]> Sergey Matveev's repositories - sgblog.git/blobdiff - cmd/sgblog/topics.go
Experimental gemini support
[sgblog.git] / cmd / sgblog / topics.go
index 907b3b3b16b7e6941f53395282709ee4ec44e5bc..9a8979376fce2c09ac3fcafa0d454b4fea33a0ad 100644 (file)
@@ -1,6 +1,6 @@
 /*
-SGBlog -- Git-backed CGI/inetd blogging/phlogging engine
-Copyright (C) 2020 Sergey Matveev <stargrave@stargrave.org>
+SGBlog -- Git-backed CGI/UCSPI blogging/phlogging/gemlogging 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
@@ -27,6 +27,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 +39,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 +76,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)
                }
        }