aboutsummaryrefslogtreecommitdiff
path: root/pkg/handler/git/handler.go
diff options
context:
space:
mode:
authorGabriel A. Giovanini <mail@gabrielgio.me>2024-07-07 20:28:42 +0200
committerGabriel A. Giovanini <mail@gabrielgio.me>2024-07-07 21:44:29 +0200
commit44bc8e4078a09857ad86691a83e7ba7d4e3a69c4 (patch)
tree6788cafeaac286d381cc69e1917dab6ae58d1f85 /pkg/handler/git/handler.go
parent8dff852753a1c4a708fd87e3cbb0f4844803aa95 (diff)
downloadcerrado-44bc8e4078a09857ad86691a83e7ba7d4e3a69c4.tar.gz
cerrado-44bc8e4078a09857ad86691a83e7ba7d4e3a69c4.tar.bz2
cerrado-44bc8e4078a09857ad86691a83e7ba7d4e3a69c4.zip
ref: Simplify path builder code
Diffstat (limited to 'pkg/handler/git/handler.go')
-rw-r--r--pkg/handler/git/handler.go19
1 files changed, 2 insertions, 17 deletions
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(),