From 44bc8e4078a09857ad86691a83e7ba7d4e3a69c4 Mon Sep 17 00:00:00 2001 From: "Gabriel A. Giovanini" Date: Sun, 7 Jul 2024 20:28:42 +0200 Subject: ref: Simplify path builder code --- pkg/handler/git/handler.go | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) (limited to 'pkg/handler') diff --git a/pkg/handler/git/handler.go b/pkg/handler/git/handler.go index 5e50122..9549f0e 100644 --- a/pkg/handler/git/handler.go +++ b/pkg/handler/git/handler.go @@ -18,7 +18,6 @@ import ( "github.com/alecthomas/chroma/v2/formatters/html" "github.com/alecthomas/chroma/v2/lexers" "github.com/alecthomas/chroma/v2/styles" - "github.com/go-git/go-git/v5/plumbing" "github.com/go-git/go-git/v5/plumbing/object" "github.com/gomarkdown/markdown" markdownhtml "github.com/gomarkdown/markdown/html" @@ -27,30 +26,16 @@ import ( type ( GitHandler struct { - gitService gitService + gitService *service.GitService readmePath string } - gitService interface { - ListRepositories() ([]*service.Repository, error) - ListCommits(name string, ref string, count int) ([]*object.Commit, error) - LastCommit(name string, ref string) (*object.Commit, error) - GetHead(name string) (*plumbing.Reference, error) - GetTree(name, ref, path string) (*object.Tree, error) - IsBinary(name, ref, path string) (bool, error) - GetFileContent(name, ref, path string) ([]byte, error) - GetAbout(name string) ([]byte, error) - ListTags(name string) ([]*plumbing.Reference, error) - ListBranches(name string) ([]*plumbing.Reference, error) - WriteTarGZip(w io.Writer, name, ref, prefix string) error - } - configurationRepository interface { GetRootReadme() string } ) -func NewGitHandler(gitService gitService, confRepo configurationRepository) *GitHandler { +func NewGitHandler(gitService *service.GitService, confRepo configurationRepository) *GitHandler { return &GitHandler{ gitService: gitService, readmePath: confRepo.GetRootReadme(), -- cgit v1.2.3