aboutsummaryrefslogtreecommitdiff
path: root/routers/repo/commit.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2014-03-30 10:19:36 +0800
committerLunny Xiao <xiaolunwen@gmail.com>2014-03-30 10:19:36 +0800
commitcd800d7837caefb129e0f006c8973460a2d64d4a (patch)
tree6c5f06fd3a1802c07332f247e2a1b3d2bc0b5c1b /routers/repo/commit.go
parent50391f434e9f7f216ce0f907b532cbe4ca2bbeb2 (diff)
parentb27c34f39acee3bf7b6594a1f0db2183b343326c (diff)
Merge branch 'master' of github.com:gogits/gogs
Diffstat (limited to 'routers/repo/commit.go')
-rw-r--r--routers/repo/commit.go18
1 files changed, 6 insertions, 12 deletions
diff --git a/routers/repo/commit.go b/routers/repo/commit.go
index afc1ffda..449f6443 100644
--- a/routers/repo/commit.go
+++ b/routers/repo/commit.go
@@ -50,16 +50,12 @@ func Commits(ctx *middleware.Context, params martini.Params) {
}
func Diff(ctx *middleware.Context, params martini.Params) {
- userName := params["username"]
- repoName := params["reponame"]
- branchName := params["branchname"]
- commitId := params["commitid"]
+ userName := ctx.Repo.Owner.Name
+ repoName := ctx.Repo.Repository.Name
+ branchName := ctx.Repo.BranchName
+ commitId := ctx.Repo.CommitId
- commit, err := models.GetCommit(userName, repoName, branchName, commitId)
- if err != nil {
- ctx.Handle(404, "repo.Diff", err)
- return
- }
+ commit := ctx.Repo.Commit
diff, err := models.GetDiff(models.RepoPath(userName, repoName), commitId)
if err != nil {
@@ -85,11 +81,9 @@ func Diff(ctx *middleware.Context, params martini.Params) {
return isImage
}
- shortSha := params["commitid"][:10]
ctx.Data["IsImageFile"] = isImageFile
- ctx.Data["Title"] = commit.Message() + " · " + shortSha
+ ctx.Data["Title"] = commit.Message() + " · " + base.ShortSha(commitId)
ctx.Data["Commit"] = commit
- ctx.Data["ShortSha"] = shortSha
ctx.Data["Diff"] = diff
ctx.Data["IsRepoToolbarCommits"] = true
ctx.Data["SourcePath"] = "/" + path.Join(userName, repoName, "src", commitId)