summaryrefslogtreecommitdiffstats
path: root/app/models
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2012-01-16 17:52:54 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2012-01-16 17:52:54 +0000
commit34d168308703266950730555efe47d6375e84e7a (patch)
treedaef214327249990e7687bff7e1f7f8bc51c95d2 /app/models
parentfef82e44a61b40f0b99bcfe8c13f23a11d366d70 (diff)
downloadredmine-34d168308703266950730555efe47d6375e84e7a.tar.gz
redmine-34d168308703266950730555efe47d6375e84e7a.zip
Skip a bunch of useless "UPDATE repositories SET extra_info = ..." queries when navigating in repositories.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8658 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models')
-rw-r--r--app/models/repository.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/app/models/repository.rb b/app/models/repository.rb
index 00acbb540..02d9fc6c8 100644
--- a/app/models/repository.rb
+++ b/app/models/repository.rb
@@ -101,9 +101,13 @@ class Repository < ActiveRecord::Base
end
def scm
- @scm ||= self.scm_adapter.new(url, root_url,
+ unless @scm
+ @scm = self.scm_adapter.new(url, root_url,
login, password, path_encoding)
- update_attribute(:root_url, @scm.root_url) if root_url.blank?
+ if root_url.blank? && @scm.root_url.present?
+ update_attribute(:root_url, @scm.root_url)
+ end
+ end
@scm
end