summaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
author无闻 <joe2010xtmf@163.com>2014-04-27 19:46:38 -0400
committer无闻 <joe2010xtmf@163.com>2014-04-27 19:46:38 -0400
commit31805e2bbea17d5fc3806f472ddab42736e7b4a1 (patch)
treef4aecb1ab5826f3f64936b084dc6c63b15fd8c67 /routers
parent41b0a7b97c2cc1ffd8751fd12690642968961d0e (diff)
parent67002575589c1b77c86ecacd6edb5a05e81015cb (diff)
downloadgitea-31805e2bbea17d5fc3806f472ddab42736e7b4a1.tar.gz
gitea-31805e2bbea17d5fc3806f472ddab42736e7b4a1.zip
Merge pull request #135 from clee/show-parents
Show parents in commit diff page
Diffstat (limited to 'routers')
-rw-r--r--routers/repo/commit.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/routers/repo/commit.go b/routers/repo/commit.go
index 9ecc697d27..d73669923b 100644
--- a/routers/repo/commit.go
+++ b/routers/repo/commit.go
@@ -91,10 +91,22 @@ func Diff(ctx *middleware.Context, params martini.Params) {
return isImage
}
+ parents := make([]string, commit.ParentCount())
+ for i := 0; i < commit.ParentCount(); i++ {
+ sha, err := commit.ParentId(i)
+ parents[i] = sha.String()
+ if err != nil {
+ ctx.Handle(404, "repo.Diff", err)
+ }
+ }
+
+ ctx.Data["Username"] = userName
+ ctx.Data["Reponame"] = repoName
ctx.Data["IsImageFile"] = isImageFile
ctx.Data["Title"] = commit.Summary() + " · " + base.ShortSha(commitId)
ctx.Data["Commit"] = commit
ctx.Data["Diff"] = diff
+ ctx.Data["Parents"] = parents
ctx.Data["DiffNotAvailable"] = diff.NumFiles() == 0
ctx.Data["IsRepoToolbarCommits"] = true
ctx.Data["SourcePath"] = "/" + path.Join(userName, repoName, "src", commitId)