summaryrefslogtreecommitdiffstats
path: root/app/models/repository.rb
diff options
context:
space:
mode:
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>2011-01-14 22:51:12 +0000
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>2011-01-14 22:51:12 +0000
commitacb0d96617390d90f909e4413c80c418dad0ffc9 (patch)
treea64135fad242d64c877acc30e691d2a98a506059 /app/models/repository.rb
parente14e244f7b5e9b205d462de4f46745a02bc3c8c9 (diff)
downloadredmine-acb0d96617390d90f909e4413c80c418dad0ffc9.tar.gz
redmine-acb0d96617390d90f909e4413c80c418dad0ffc9.zip
scm: use #blank? instead of #nil? || #empty? at Repository#find_changeset_by_name(name) (#7307).
Referring r4711. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4712 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/repository.rb')
-rw-r--r--app/models/repository.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/app/models/repository.rb b/app/models/repository.rb
index 0a5b426c7..3d463b82f 100644
--- a/app/models/repository.rb
+++ b/app/models/repository.rb
@@ -98,13 +98,13 @@ class Repository < ActiveRecord::Base
def relative_path(path)
path
end
-
+
# Finds and returns a revision with a number or the beginning of a hash
def find_changeset_by_name(name)
- return nil if name.nil? || name.empty?
+ return nil if name.blank?
changesets.find(:first, :conditions => (name.match(/^\d*$/) ? ["revision = ?", name.to_s] : ["revision LIKE ?", name + '%']))
end
-
+
def latest_changeset
@latest_changeset ||= changesets.find(:first)
end