diff options
author | Chris Lee <clee@mg8.org> | 2014-04-27 23:43:14 +0000 |
---|---|---|
committer | Chris Lee <clee@mg8.org> | 2014-04-27 23:43:14 +0000 |
commit | 67002575589c1b77c86ecacd6edb5a05e81015cb (patch) | |
tree | 943cdeb6bc9d0efc828f1bb43a50869dd5a3d701 /routers | |
parent | 8a8f84d245ed7b5cd007b43747098663019654c7 (diff) | |
download | gitea-67002575589c1b77c86ecacd6edb5a05e81015cb.tar.gz gitea-67002575589c1b77c86ecacd6edb5a05e81015cb.zip |
Show parents in commit diff page
Diffstat (limited to 'routers')
-rw-r--r-- | routers/repo/commit.go | 12 |
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) |