From f1643ffcbd543cacfe9ab5e46eafdd0c39cd47fd Mon Sep 17 00:00:00 2001 From: "Gabriel A. Giovanini" Date: Sat, 1 Jun 2024 18:24:22 +0200 Subject: feat: Add refs page UI now it is a broken state. I'll all pages working first so I can better style it later. --- pkg/service/git.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'pkg/service/git.go') diff --git a/pkg/service/git.go b/pkg/service/git.go index 614770f..57b9b6e 100644 --- a/pkg/service/git.go +++ b/pkg/service/git.go @@ -5,6 +5,7 @@ import ( "git.gabrielgio.me/cerrado/pkg/config" "git.gabrielgio.me/cerrado/pkg/git" + "github.com/go-git/go-git/v5/plumbing" "github.com/go-git/go-git/v5/plumbing/object" ) @@ -65,3 +66,19 @@ func (g *GitService) ListCommits(name string) ([]*object.Commit, error) { repo := git.NewGitRepository(r.Path) return repo.Commits() } + +func (g *GitService) ListTags(name string) ([]*object.Tag, error) { + // TODO: handle nil + r := g.configRepo.GetByName(name) + + repo := git.NewGitRepository(r.Path) + return repo.Tags() +} + +func (g *GitService) ListBranches(name string) ([]*plumbing.Reference, error) { + // TODO: handle nil + r := g.configRepo.GetByName(name) + + repo := git.NewGitRepository(r.Path) + return repo.Branches() +} -- cgit v1.2.3