From ce5185f551b707fe8dd8db8b5cbffd46e96cacc0 Mon Sep 17 00:00:00 2001 From: "Gabriel A. Giovanini" Date: Sat, 15 Jun 2024 19:07:14 +0200 Subject: feat: Add per repository about page --- pkg/service/git.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'pkg/service/git.go') diff --git a/pkg/service/git.go b/pkg/service/git.go index 2165abe..6bb6e9e 100644 --- a/pkg/service/git.go +++ b/pkg/service/git.go @@ -128,6 +128,24 @@ func (g *GitService) GetFileContent(name, ref, path string) (string, error) { return repo.FileContent(path) } +func (g *GitService) GetAbout(name string) (string, error) { + r := g.configRepo.GetByName(name) + if r == nil { + return "", RepositoryNotFoundErr + } + + repo, err := git.OpenRepository(r.Path) + if err != nil { + return "", err + } + err = repo.SetRef("") + if err != nil { + return "", err + } + + return repo.FileContent(r.About) +} + func (g *GitService) ListTags(name string) ([]*plumbing.Reference, error) { r := g.configRepo.GetByName(name) if r == nil { -- cgit v1.2.3