Method: Repository#contributors
- Defined in:
- app/models/repository.rb
#contributors(ref: nil, order_by: nil, sort: 'asc') ⇒ Object
Params:
order_by: name|email|commits sort: asc|desc default: ‘asc’
828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 |
# File 'app/models/repository.rb', line 828 def contributors(ref: nil, order_by: nil, sort: 'asc') commits = self.commits(ref, limit: 2000, offset: 0, skip_merges: true) commits = commits.group_by(&:author_email).map do |email, commits| contributor = Gitlab::Contributor.new contributor.email = email commits.each do |commit| if contributor.name.blank? contributor.name = commit. end contributor.commits += 1 end contributor end Commit.order_by(collection: commits, order_by: order_by, sort: sort) end |