]> source.dussan.org Git - gitea.git/commitdiff
combine getCommit ById and ByBranch in routers/repo/commit.go
authorzhsso <zhssoge@gmail.com>
Sat, 12 Apr 2014 02:57:25 +0000 (22:57 -0400)
committerzhsso <zhssoge@gmail.com>
Sat, 12 Apr 2014 02:57:25 +0000 (22:57 -0400)
routers/repo/commit.go

index e6f6d7ed8991757a714d43f18e89782d0635ccaa..5a7bb589f71cccf1e4392e4a79465f99d2e58d18 100644 (file)
@@ -50,18 +50,8 @@ func Commits(ctx *middleware.Context, params martini.Params) {
                nextPage = 0
        }
 
-       var commits *list.List
-       if models.IsBranchExist(userName, repoName, branchName) {
-               // 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
-       }
+       //both `git log branchName` and `git log  commitId` work
+       commits, err := models.GetCommitsByRange(repoPath, branchName, page)
 
        ctx.Data["Username"] = userName
        ctx.Data["Reponame"] = repoName