aboutsummaryrefslogtreecommitdiff
path: root/pkg/handler/git/handler.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/handler/git/handler.go')
-rw-r--r--pkg/handler/git/handler.go29
1 files changed, 24 insertions, 5 deletions
diff --git a/pkg/handler/git/handler.go b/pkg/handler/git/handler.go
index 4809362..899f61e 100644
--- a/pkg/handler/git/handler.go
+++ b/pkg/handler/git/handler.go
@@ -29,7 +29,7 @@ type (
gitService interface {
ListRepositories() ([]*service.Repository, error)
- ListCommits(name string, ref string) ([]*object.Commit, error)
+ ListCommits(name string, ref string, count int) ([]*object.Commit, error)
GetHead(name string) (*plumbing.Reference, error)
GetTree(name, ref, path string) (*object.Tree, error)
GetFileContent(name, ref, path string) (string, error)
@@ -91,10 +91,29 @@ func (g *GitHandler) Summary(w http.ResponseWriter, r *http.Request) error {
return err
}
+ tags, err := g.gitService.ListTags(name)
+ if err != nil {
+ return err
+ }
+
+ branches, err := g.gitService.ListBranches(name)
+ if err != nil {
+ return err
+ }
+
+ commits, err := g.gitService.ListCommits(name, "", 10)
+ if err != nil {
+ return err
+ }
+
gitList := &templates.GitItemPage{
- Name: name,
- Ref: ref.Name().Short(),
- GitItemBase: &templates.GitItemSummaryPage{},
+ Name: name,
+ Ref: ref.Name().Short(),
+ GitItemBase: &templates.GitItemSummaryPage{
+ Tags: tags,
+ Branches: branches,
+ Commits: commits,
+ },
}
templates.WritePageTemplate(w, gitList)
return nil
@@ -215,7 +234,7 @@ func (g *GitHandler) Log(w http.ResponseWriter, r *http.Request) error {
name := r.PathValue("name")
ref := r.PathValue("ref")
- commits, err := g.gitService.ListCommits(name, ref)
+ commits, err := g.gitService.ListCommits(name, ref, 1000)
if err != nil {
return err
}