diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index 3993368a7..3129dbf02 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -354,17 +354,16 @@ update def get_commits(id) g = Gitlab.client - tmp_commit = g.commits(id,page:0) - commits = [] + tmp_commit_count = g.commits(id,page:0).count + commit_count = 0 i=0 - while tmp_commit!=[] - commits = commits+tmp_commit + while tmp_commit_count!=0 + commit_count = commit_count+tmp_commit_count i=i+1 - tmp_commit = g.commits(id,page:i) + tmp_commit_count = g.commits(id,page:i).count end - commits_count = commits.length - return commits_count + return commit_count end @@ -377,7 +376,7 @@ update @commits = g.commits(@project.gpid, page:(params[:page].to_i - 1).to_s) - @commits_count = get_commits(@project.gpid) + @commits_count = params[:commit_count].to_i @commits_pages = Redmine::Pagination::Paginator.new @commits_count,limit,params[:page] @commit = g.commit(@project.gpid,@rev) diff --git a/app/views/repositories/show.html.erb b/app/views/repositories/show.html.erb index e8596b717..7aac3af1d 100644 --- a/app/views/repositories/show.html.erb +++ b/app/views/repositories/show.html.erb @@ -40,7 +40,8 @@ - <%=link_to @changesets_all_count, {:action => 'changes', :path => to_path_param(@path), :id => @project, :repository_id => @repository.identifier_param, :rev => @rev,:page=>1} %> 提交 + <%=link_to @changesets_all_count, {:action => 'changes', :path => to_path_param(@path), :id => @project, :repository_id => @repository.identifier_param, :rev => @rev,:page=>1 ,:commit_count =>"#{@changesets_all_count}"} %> 提交 + <% end %>