add commit view

This commit is contained in:
Lunny Xiao 2014-03-18 11:22:19 +08:00
parent e656609b0d
commit 3ceb008e1f
4 changed files with 48 additions and 26 deletions

View file

@ -69,7 +69,7 @@ func Single(ctx *middleware.Context, params martini.Params) {
// Directory and file list.
files, err := models.GetReposFiles(params["username"], params["reponame"],
params["branchname"], treename)
params["branchname"], params["commitid"], treename)
if err != nil {
log.Error("repo.Single(GetReposFiles): %v", err)
ctx.Render.Error(404)
@ -90,13 +90,14 @@ func Single(ctx *middleware.Context, params martini.Params) {
}
// Get latest commit according username and repo name
commit, err := models.GetLastestCommit(params["username"], params["reponame"])
commit, err := models.GetCommit(params["username"], params["reponame"],
params["branchname"], params["commitid"])
if err != nil {
log.Error("repo.Single(GetLastestCommit): %v", err)
log.Error("repo.Single(GetCommit): %v", err)
ctx.Render.Error(404)
return
}
ctx.Data["LatestCommit"] = commit
ctx.Data["CurrentCommit"] = commit
var readmeFile *models.RepoFile