From: Toshi MARUYAMA Date: Thu, 19 May 2011 02:16:27 +0000 (+0000) Subject: scm: git: set revisions ordering inconsistent in existing database (#5357). X-Git-Tag: 1.2.0~40 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=098655dbd061111e7389b6558026edf2f6898f97;p=redmine.git scm: git: set revisions ordering inconsistent in existing database (#5357). Between version 0.9 r2840 (#1406) and version 1.2 r5073 (#7821, #5357), git revisions are stored as *C-B-A-F-E-D* in database. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@5853 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/app/models/repository/git.rb b/app/models/repository/git.rb index 3e2edd9f7..7b229a279 100644 --- a/app/models/repository/git.rb +++ b/app/models/repository/git.rb @@ -109,7 +109,17 @@ class Repository::Git < Repository scm_brs = branches return if scm_brs.nil? || scm_brs.empty? h = extra_info || {} - h["branches"] ||= {} + h["branches"] ||= {} + h["db_consistent"] ||= {} + if changesets.count == 0 + h["db_consistent"]["ordering"] = 1 + merge_extra_info(h) + self.save + elsif ! h["db_consistent"].has_key?("ordering") + h["db_consistent"]["ordering"] = 0 + merge_extra_info(h) + self.save + end scm_brs.each do |br| from_scmid = nil from_scmid = h["branches"][br]["last_scmid"] if h["branches"][br]