summaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
authorlunnyxiao <xiaolunwen@gmail.com>2014-09-22 14:23:36 +0800
committerlunnyxiao <xiaolunwen@gmail.com>2014-09-22 14:23:36 +0800
commit7df60af60ed6d9606c5894c6512522dc91d0c247 (patch)
tree7d86223b4204d042b96cc31d71a3435860377581 /routers
parent79ec08141af6f156597064f5fcafc4d0af2e1a05 (diff)
downloadgitea-7df60af60ed6d9606c5894c6512522dc91d0c247.tar.gz
gitea-7df60af60ed6d9606c5894c6512522dc91d0c247.zip
submodule support and closed #478
Diffstat (limited to 'routers')
-rw-r--r--routers/repo/view.go28
1 files changed, 14 insertions, 14 deletions
diff --git a/routers/repo/view.go b/routers/repo/view.go
index 41fdaba08c..77f17e7ae0 100644
--- a/routers/repo/view.go
+++ b/routers/repo/view.go
@@ -10,7 +10,6 @@ import (
"path"
"path/filepath"
"strings"
- "time"
"github.com/gogits/gogs/modules/base"
"github.com/gogits/gogs/modules/git"
@@ -23,12 +22,10 @@ const (
)
type fakeCommit struct {
- Id string
- Summary string
- Url string
- Committer struct {
- When time.Time
- }
+ *git.Commit
+
+ RefUrl string
+ RefId string
}
func Home(ctx *middleware.Context) {
@@ -151,13 +148,16 @@ func Home(ctx *middleware.Context) {
return
}
- commit := git.Commit{
- Tree: *tree,
- Id: te.Id,
- Committer: &git.Signature{
- When: time.Now(),
- },
- CommitMessage: sm.Url,
+ c, err := ctx.Repo.Commit.GetCommitOfRelPath(filepath.Join(treePath, te.Name()))
+ if err != nil {
+ ctx.Handle(404, "GetCommitOfRelPath", err)
+ return
+ }
+
+ commit := fakeCommit{
+ Commit: c,
+ RefUrl: strings.TrimRight(sm.Url, ".git"),
+ RefId: te.Id.String(),
}
files = append(files, []interface{}{te, &commit})