summaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
authorUnknwon <joe2010xtmf@163.com>2014-09-26 08:55:13 -0400
committerUnknwon <joe2010xtmf@163.com>2014-09-26 08:55:13 -0400
commitb8368f98ffc79a6c6c7bceed50a2989049d3eb1a (patch)
treeeb6918a6539cfa68b6cc4a582c21fd0e3e4d2348 /routers
parent3164354255a01e98b1c5d4d668c3b1c62474b240 (diff)
downloadgitea-b8368f98ffc79a6c6c7bceed50a2989049d3eb1a.tar.gz
gitea-b8368f98ffc79a6c6c7bceed50a2989049d3eb1a.zip
Add directory level commit message
Diffstat (limited to 'routers')
-rw-r--r--routers/repo/commit.go4
-rw-r--r--routers/repo/view.go20
2 files changed, 18 insertions, 6 deletions
diff --git a/routers/repo/commit.go b/routers/repo/commit.go
index 512df2534f..9791cc5511 100644
--- a/routers/repo/commit.go
+++ b/routers/repo/commit.go
@@ -61,7 +61,7 @@ func Commits(ctx *middleware.Context) {
ctx.Handle(500, "CommitsByRange", err)
return
}
- commits = models.ValidCommitsWithEmails(commits)
+ commits = models.ValidateCommitsWithEmails(commits)
ctx.Data["Commits"] = commits
ctx.Data["Username"] = userName
@@ -99,7 +99,7 @@ func SearchCommits(ctx *middleware.Context) {
ctx.Handle(500, "SearchCommits", err)
return
}
- commits = models.ValidCommitsWithEmails(commits)
+ commits = models.ValidateCommitsWithEmails(commits)
ctx.Data["Keyword"] = keyword
ctx.Data["Username"] = userName
diff --git a/routers/repo/view.go b/routers/repo/view.go
index 4e4a7b18ce..82f3460029 100644
--- a/routers/repo/view.go
+++ b/routers/repo/view.go
@@ -11,6 +11,7 @@ import (
"path/filepath"
"strings"
+ "github.com/gogits/gogs/models"
"github.com/gogits/gogs/modules/base"
"github.com/gogits/gogs/modules/git"
"github.com/gogits/gogs/modules/log"
@@ -130,20 +131,20 @@ func Home(ctx *middleware.Context) {
if te.Type != git.COMMIT {
c, err := ctx.Repo.Commit.GetCommitOfRelPath(filepath.Join(treePath, te.Name()))
if err != nil {
- ctx.Handle(404, "GetCommitOfRelPath", err)
+ ctx.Handle(500, "GetCommitOfRelPath", err)
return
}
files = append(files, []interface{}{te, c})
} else {
sm, err := ctx.Repo.Commit.GetSubModule(path.Join(treename, te.Name()))
if err != nil {
- ctx.Handle(404, "GetSubModule", err)
+ ctx.Handle(500, "GetSubModule", err)
return
}
c, err := ctx.Repo.Commit.GetCommitOfRelPath(filepath.Join(treePath, te.Name()))
if err != nil {
- ctx.Handle(404, "GetCommitOfRelPath", err)
+ ctx.Handle(500, "GetCommitOfRelPath", err)
return
}
files = append(files, []interface{}{te, git.NewSubModuleFile(c, sm.Url, te.Id.String())})
@@ -195,6 +196,18 @@ func Home(ctx *middleware.Context) {
}
}
}
+
+ lastCommit := ctx.Repo.Commit
+ if len(treePath) > 0 {
+ c, err := ctx.Repo.Commit.GetCommitOfRelPath(treePath)
+ if err != nil {
+ ctx.Handle(500, "GetCommitOfRelPath", err)
+ return
+ }
+ lastCommit = c
+ }
+ ctx.Data["LastCommit"] = lastCommit
+ ctx.Data["LastCommitUser"] = models.ValidateCommitWithEmail(lastCommit)
}
ctx.Data["Username"] = userName
@@ -215,7 +228,6 @@ func Home(ctx *middleware.Context) {
}
}
- ctx.Data["LastCommit"] = ctx.Repo.Commit
ctx.Data["Paths"] = Paths
ctx.Data["TreeName"] = treename
ctx.Data["Treenames"] = treenames