summaryrefslogtreecommitdiffstats
path: root/routers/repo/commit.go
diff options
context:
space:
mode:
Diffstat (limited to 'routers/repo/commit.go')
-rw-r--r--routers/repo/commit.go13
1 files changed, 4 insertions, 9 deletions
diff --git a/routers/repo/commit.go b/routers/repo/commit.go
index e6f6d7ed89..dbfd9af297 100644
--- a/routers/repo/commit.go
+++ b/routers/repo/commit.go
@@ -50,16 +50,10 @@ 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)
- }
-
+ //both `git log branchName` and `git log commitId` work
+ commits, err := models.GetCommitsByRange(repoPath, branchName, page)
if err != nil {
- ctx.Handle(404, "repo.Commits(get commits)", err)
+ ctx.Handle(500, "repo.Commits(get commits)", err)
return
}
@@ -109,6 +103,7 @@ func Diff(ctx *middleware.Context, params martini.Params) {
ctx.Data["Title"] = commit.Message() + " ยท " + base.ShortSha(commitId)
ctx.Data["Commit"] = commit
ctx.Data["Diff"] = diff
+ ctx.Data["DiffNotAvailable"] = diff.NumFiles() == 0
ctx.Data["IsRepoToolbarCommits"] = true
ctx.Data["SourcePath"] = "/" + path.Join(userName, repoName, "src", commitId)
ctx.Data["RawPath"] = "/" + path.Join(userName, repoName, "raw", commitId)