diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2014-04-30 10:24:00 +0800 |
---|---|---|
committer | Lunny Xiao <xiaolunwen@gmail.com> | 2014-04-30 10:24:00 +0800 |
commit | a85f242030f8fa0d74c9d82485d0649926bc6db4 (patch) | |
tree | 43c7850b7c01c635d36f368c108f6305b10e13f2 /routers/repo/commit.go | |
parent | cdc843f06b90acf71211a684ba32cd92c765230d (diff) | |
parent | 0d6856dbe73c8041451743946fb324663350a687 (diff) |
Merge branch 'dev' of github.com:gogits/gogs into dev
Diffstat (limited to 'routers/repo/commit.go')
-rw-r--r-- | routers/repo/commit.go | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/routers/repo/commit.go b/routers/repo/commit.go index 6e20a7b7..bc33fe44 100644 --- a/routers/repo/commit.go +++ b/routers/repo/commit.go @@ -91,10 +91,23 @@ 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) + return + } + } + + ctx.Data["Username"] = userName + ctx.Data["Reponame"] = repoName ctx.Data["IsImageFile"] = isImageFile - ctx.Data["Title"] = commit.Message() + " · " + base.ShortSha(commitId) + 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) |