summaryrefslogtreecommitdiffstats
path: root/routers/repo/commit.go
diff options
context:
space:
mode:
authorUnknown <joe2010xtmf@163.com>2014-03-25 23:53:01 -0400
committerUnknown <joe2010xtmf@163.com>2014-03-25 23:53:01 -0400
commit87de66561c0ecc14f42a24242d850b586f143080 (patch)
tree82ea1d1c1f3bfaa10142529610afd3856b575d3d /routers/repo/commit.go
parentc1a3d4fefbbbf332cd1cedda66e93bf40cc9713d (diff)
downloadgitea-87de66561c0ecc14f42a24242d850b586f143080.tar.gz
gitea-87de66561c0ecc14f42a24242d850b586f143080.zip
Start working on diff page
Diffstat (limited to 'routers/repo/commit.go')
-rw-r--r--routers/repo/commit.go22
1 files changed, 19 insertions, 3 deletions
diff --git a/routers/repo/commit.go b/routers/repo/commit.go
index e038998f94..3d00f8d747 100644
--- a/routers/repo/commit.go
+++ b/routers/repo/commit.go
@@ -34,8 +34,24 @@ func Commits(ctx *middleware.Context, params martini.Params) {
ctx.HTML(200, "repo/commits")
}
-func Diff(ctx *middleware.Context,params martini.Params){
- ctx.Data["Title"] = "commit-sha"
+func Diff(ctx *middleware.Context, params martini.Params) {
+ commit, err := models.GetCommit(params["username"], params["reponame"], params["branchname"], params["commitid"])
+ if err != nil {
+ ctx.Handle(404, "repo.Diff", err)
+ return
+ }
+
+ diff, err := models.GetDiff(models.RepoPath(params["username"], params["reponame"]), params["commitid"])
+ if err != nil {
+ ctx.Handle(404, "repo.Diff", err)
+ return
+ }
+
+ shortSha := params["commitid"][:7]
+ ctx.Data["Title"] = commit.Message() + " ยท " + shortSha
+ ctx.Data["Commit"] = commit
+ ctx.Data["ShortSha"] = shortSha
+ ctx.Data["Diff"] = diff
ctx.Data["IsRepoToolbarCommits"] = true
- ctx.HTML(200,"repo/diff")
+ ctx.HTML(200, "repo/diff")
}