1
0
mirror of https://github.com/go-gitea/gitea.git synced 2024-10-29 08:17:31 -04:00

combine getCommit ById and ByBranch in routers/repo/commit.go

This commit is contained in:
zhsso 2014-04-11 22:57:25 -04:00
parent 5d30bfc8ba
commit 2e6d50addc

View File

@ -50,18 +50,8 @@ func Commits(ctx *middleware.Context, params martini.Params) {
nextPage = 0 nextPage = 0
} }
var commits *list.List //both `git log branchName` and `git log commitId` work
if models.IsBranchExist(userName, repoName, branchName) { commits, err := models.GetCommitsByRange(repoPath, branchName, page)
// commits, err = models.GetCommitsByBranch(userName, repoName, branchName)
commits, err = models.GetCommitsByRange(repoPath, branchName, page)
} else {
commits, err = models.GetCommitsByCommitId(userName, repoName, branchName)
}
if err != nil {
ctx.Handle(404, "repo.Commits(get commits)", err)
return
}
ctx.Data["Username"] = userName ctx.Data["Username"] = userName
ctx.Data["Reponame"] = repoName ctx.Data["Reponame"] = repoName