diff options
Diffstat (limited to 'pkg/service/git.go')
-rw-r--r-- | pkg/service/git.go | 10 |
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() +} |