@@ -50,16 +50,10 @@ func Commits(ctx *middleware.Context, params martini.Params) {
5050 nextPage = 0
5151 }
5252
53- var commits * list.List
54- if models .IsBranchExist (userName , repoName , branchName ) {
55- // commits, err = models.GetCommitsByBranch(userName, repoName, branchName)
56- commits , err = models .GetCommitsByRange (repoPath , branchName , page )
57- } else {
58- commits , err = models .GetCommitsByCommitId (userName , repoName , branchName )
59- }
60-
53+ //both `git log branchName` and `git log commitId` work
54+ commits , err := models .GetCommitsByRange (repoPath , branchName , page )
6155 if err != nil {
62- ctx .Handle (404 , "repo.Commits(get commits)" , err )
56+ ctx .Handle (500 , "repo.Commits(get commits)" , err )
6357 return
6458 }
6559
@@ -109,6 +103,7 @@ func Diff(ctx *middleware.Context, params martini.Params) {
109103 ctx .Data ["Title" ] = commit .Message () + " · " + base .ShortSha (commitId )
110104 ctx .Data ["Commit" ] = commit
111105 ctx .Data ["Diff" ] = diff
106+ ctx .Data ["DiffNotAvailable" ] = diff .NumFiles () == 0
112107 ctx .Data ["IsRepoToolbarCommits" ] = true
113108 ctx .Data ["SourcePath" ] = "/" + path .Join (userName , repoName , "src" , commitId )
114109 ctx .Data ["RawPath" ] = "/" + path .Join (userName , repoName , "raw" , commitId )
0 commit comments