diff options
author | Gabriel A. Giovanini <mail@gabrielgio.me> | 2024-06-15 19:07:14 +0200 |
---|---|---|
committer | Gabriel A. Giovanini <mail@gabrielgio.me> | 2024-06-15 19:07:14 +0200 |
commit | ce5185f551b707fe8dd8db8b5cbffd46e96cacc0 (patch) | |
tree | b4b83a117a7c479589cfce022011e725e24529e8 /pkg/service | |
parent | b71c6c0e5b8dd00d44e40ac0551902a23cbe19d5 (diff) | |
download | cerrado-ce5185f551b707fe8dd8db8b5cbffd46e96cacc0.tar.gz cerrado-ce5185f551b707fe8dd8db8b5cbffd46e96cacc0.tar.bz2 cerrado-ce5185f551b707fe8dd8db8b5cbffd46e96cacc0.zip |
feat: Add per repository about page
Diffstat (limited to 'pkg/service')
-rw-r--r-- | pkg/service/git.go | 18 |
1 files changed, 18 insertions, 0 deletions
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 { |