diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index 08ffca920..e2a3e2d2a 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -382,7 +382,8 @@ update if request.xhr? @entries ? render(:partial => 'dir_list_content') : render(:nothing => true) else - @changesets_latest_coimmit = @g.commits(@project.gpid, :ref_name => @rev)[0] + @changesets_latest_coimmit = @g.commit(@project.gpid, @entries.first.try(:lastrev)) + # @changesets_latest_coimmit = @g.commits(@project.gpid, :ref_name => @rev)[0] # 总的提交数 @changesets_all_count = @g.user_static(@project.gpid, :rev => @rev).count diff --git a/app/models/repository.rb b/app/models/repository.rb index 305c82f97..c9346e15b 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -422,8 +422,8 @@ class Repository < ActiveRecord::Base def load_entries_changesets(entries) if entries entries.each do |entry| - if entry.lastrev && entry.lastrev.identifier - entry.changeset = find_changeset_by_name(entry.lastrev.identifier) + if entry.lastrev + entry.changeset = entry.lastrev end end end diff --git a/app/views/repositories/show.html.erb b/app/views/repositories/show.html.erb index a0ae74d73..8b47190e5 100644 --- a/app/views/repositories/show.html.erb +++ b/app/views/repositories/show.html.erb @@ -49,7 +49,7 @@
- <% if @changesets && !@changesets.empty? %> + <% if @changesets_latest_coimmit %> <% if !user_commit_rep(@changesets_latest_coimmit.author_email).nil? %> <%= image_tag(url_to_avatar(user_commit_rep(@changesets_latest_coimmit.author_email)), :width => "25", :height => "25", :class => "fl portraitRadius mt2 ml4 mr5") %> diff --git a/lib/redmine/scm/adapters/gitlab_adapter.rb b/lib/redmine/scm/adapters/gitlab_adapter.rb index 7b2d18310..4aaf8fc91 100644 --- a/lib/redmine/scm/adapters/gitlab_adapter.rb +++ b/lib/redmine/scm/adapters/gitlab_adapter.rb @@ -96,7 +96,7 @@ module Redmine :path => File.join(path,tree.name), :kind => tree.type == 'tree' ? 'dir' : 'file', :size => nil, - :lastrev => nil + :lastrev => tree.commit_id }) end entries.sort_by_name