Template
1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo synced 2024-11-28 12:46:09 +01:00

Merge pull request #73 from zhsso/dev

combine getCommit ById and ByBranch in routers/repo/commit.go
This commit is contained in:
无闻 2014-04-11 23:14:28 -04:00
commit 3df8b2bef0

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