From 77e03b508b96dc50babdc4c33dbcaca045268425 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sun, 8 Jul 2012 12:26:49 +0000 Subject: [PATCH] Merged r9875 from trunk. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/1.4-stable@9951 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/models/repository.rb | 4 ++-- doc/CHANGELOG | 1 + test/unit/repository_test.rb | 9 +++++++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/app/models/repository.rb b/app/models/repository.rb index e3e67505a..e65b82ef0 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -37,8 +37,8 @@ class Repository < ActiveRecord::Base validates_presence_of :identifier, :unless => Proc.new { |r| r.is_default? || r.set_as_default? } validates_uniqueness_of :identifier, :scope => :project_id, :allow_blank => true validates_exclusion_of :identifier, :in => %w(show entry raw changes annotate diff show stats graph) - # donwcase letters, digits, dashes but not digits only - validates_format_of :identifier, :with => /^(?!\d+$)[a-z0-9\-]*$/, :allow_blank => true + # donwcase letters, digits, dashes, underscores but not digits only + validates_format_of :identifier, :with => /^(?!\d+$)[a-z0-9\-_]*$/, :allow_blank => true # Checks if the SCM is enabled when creating a repository validate :repo_create_validation, :on => :create diff --git a/doc/CHANGELOG b/doc/CHANGELOG index 52fff8abe..69b589306 100644 --- a/doc/CHANGELOG +++ b/doc/CHANGELOG @@ -6,6 +6,7 @@ http://www.redmine.org/ == TBD v1.4.5 +* Defect #11192: Make repository identifier accept underscores * Patch #11328: Fix Japanese mistranslation for 'label_language_based' == 2012-06-18 v1.4.4 diff --git a/test/unit/repository_test.rb b/test/unit/repository_test.rb index 466babb38..c90c825d8 100644 --- a/test/unit/repository_test.rb +++ b/test/unit/repository_test.rb @@ -97,6 +97,15 @@ class RepositoryTest < ActiveSupport::TestCase assert_equal [repository1, repository2], Project.find(3).repositories.sort end + def test_identifier_should_accept_letters_digits_dashes_and_underscores + r = Repository::Subversion.new( + :project_id => 3, + :identifier => 'svn-123_45', + :url => 'file:///svn' + ) + assert r.save + end + def test_destroy changesets = Changeset.count(:all, :conditions => "repository_id = 10") changes = Change.count(:all, :conditions => "repository_id = 10",