aboutsummaryrefslogtreecommitdiff
path: root/pkg/service
diff options
context:
space:
mode:
authorGabriel A. Giovanini <mail@gabrielgio.me>2024-06-01 17:20:59 +0200
committerGabriel A. Giovanini <mail@gabrielgio.me>2024-06-01 17:20:59 +0200
commit4ea63e98cc999ab05d1ac98b64875d7413e86972 (patch)
tree0edf4f1a65fd53d0e2d6e5bcbbafb5a71faa6cc7 /pkg/service
parent8f5f9ff24b0327f7640e3619de109e1f19cfba1d (diff)
downloadcerrado-4ea63e98cc999ab05d1ac98b64875d7413e86972.tar.gz
cerrado-4ea63e98cc999ab05d1ac98b64875d7413e86972.tar.bz2
cerrado-4ea63e98cc999ab05d1ac98b64875d7413e86972.zip
feat: Add initial log
Diffstat (limited to 'pkg/service')
-rw-r--r--pkg/service/git.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/pkg/service/git.go b/pkg/service/git.go
index 2b1fe25..614770f 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/object"
)
type (
@@ -21,6 +22,7 @@ type (
configurationRepository interface {
List() []*config.GitRepositoryConfiguration
+ GetByName(name string) *config.GitRepositoryConfiguration
}
)
@@ -55,3 +57,11 @@ func (g *GitService) ListRepositories() ([]*Repository, error) {
return repos, nil
}
+
+func (g *GitService) ListCommits(name string) ([]*object.Commit, error) {
+ // TODO: handle nil
+ r := g.configRepo.GetByName(name)
+
+ repo := git.NewGitRepository(r.Path)
+ return repo.Commits()
+}