Defect #5357 » git-order-new.diff
app/models/repository/git.rb | ||
---|---|---|
18 | 18 |
require 'redmine/scm/adapters/git_adapter' |
19 | 19 | |
20 | 20 |
class Repository::Git < Repository |
21 |
# sort changesets by reverse commit order |
|
22 |
has_many :changesets, :order => "#{Changeset.table_name}.id DESC", :foreign_key => 'repository_id' |
|
23 | ||
21 | 24 |
attr_protected :root_url |
22 | 25 |
validates_presence_of :url |
23 | 26 | |
... | ... | |
49 | 52 |
c = changesets.find(:first, :order => 'committed_on DESC') |
50 | 53 |
since = (c ? c.committed_on - 7.days : nil) |
51 | 54 | |
52 |
revisions = scm.revisions('', nil, nil, :all => true, :since => since) |
|
55 |
revisions = scm.revisions('', nil, nil, :all => true, :since => since, :reverse => true)
|
|
53 | 56 |
return if revisions.nil? || revisions.empty? |
54 | 57 | |
55 | 58 |
recent_changesets = changesets.find(:all, :conditions => ['committed_on >= ?', since]) |
... | ... | |
75 | 78 |
"scmid IN (?)", |
76 | 79 |
revisions.map!{|c| c.scmid} |
77 | 80 |
], |
78 |
:order => 'committed_on DESC'
|
|
81 |
:order => 'id DESC'
|
|
79 | 82 |
) |
80 | 83 |
end |
81 | 84 |
end |