aboutsummaryrefslogtreecommitdiff
path: root/pkg/service/git.go
diff options
context:
space:
mode:
authorGabriel A. Giovanini <mail@gabrielgio.me>2024-06-01 18:24:22 +0200
committerGabriel A. Giovanini <mail@gabrielgio.me>2024-06-01 18:24:22 +0200
commitf1643ffcbd543cacfe9ab5e46eafdd0c39cd47fd (patch)
treea24d3cbb625f642c25cdc14124b8971fa9bfeb04 /pkg/service/git.go
parent4ea63e98cc999ab05d1ac98b64875d7413e86972 (diff)
downloadcerrado-f1643ffcbd543cacfe9ab5e46eafdd0c39cd47fd.tar.gz
cerrado-f1643ffcbd543cacfe9ab5e46eafdd0c39cd47fd.tar.bz2
cerrado-f1643ffcbd543cacfe9ab5e46eafdd0c39cd47fd.zip
feat: Add refs page
UI now it is a broken state. I'll all pages working first so I can better style it later.
Diffstat (limited to 'pkg/service/git.go')
-rw-r--r--pkg/service/git.go17
1 files changed, 17 insertions, 0 deletions
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()
+}