From: Jean-Philippe Lang Date: Tue, 12 Jun 2012 17:43:23 +0000 (+0000) Subject: Fixed that Subversion#load_entries_changesets raises an error if entries is nil. X-Git-Tag: 2.1.0~450 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=667693b32cfaf5ff3c87b705cb494029117c80f4;p=redmine.git Fixed that Subversion#load_entries_changesets raises an error if entries is nil. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9823 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/app/models/repository/subversion.rb b/app/models/repository/subversion.rb index 7c12f3f3e..c50e99ec8 100644 --- a/app/models/repository/subversion.rb +++ b/app/models/repository/subversion.rb @@ -89,6 +89,8 @@ class Repository::Subversion < Repository protected def load_entries_changesets(entries) + return unless entries + entries_with_identifier = entries.select {|entry| entry.lastrev && entry.lastrev.identifier.present?} identifiers = entries_with_identifier.map {|entry| entry.lastrev.identifier}.compact.uniq diff --git a/test/unit/repository_subversion_test.rb b/test/unit/repository_subversion_test.rb index 699ef886a..e2550453a 100644 --- a/test/unit/repository_subversion_test.rb +++ b/test/unit/repository_subversion_test.rb @@ -61,6 +61,11 @@ class RepositorySubversionTest < ActiveSupport::TestCase assert_kind_of Redmine::Scm::Adapters::Entries, entries end + def test_entries_for_invalid_path_should_return_nil + entries = @repository.entries('invalid_path') + assert_nil entries + end + def test_latest_changesets assert_equal 0, @repository.changesets.count @repository.fetch_changesets