From 4ea63e98cc999ab05d1ac98b64875d7413e86972 Mon Sep 17 00:00:00 2001 From: "Gabriel A. Giovanini" Date: Sat, 1 Jun 2024 17:20:59 +0200 Subject: feat: Add initial log --- pkg/service/git.go | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'pkg/service') 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() +} -- cgit v1.2.3