]> source.dussan.org Git - redmine.git/commitdiff
CVS root_url not recognized when connection string does not include port (#14422).
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Mon, 15 Jul 2013 21:06:54 +0000 (21:06 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Mon, 15 Jul 2013 21:06:54 +0000 (21:06 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@12027 e93f8b46-1217-0410-a6f0-8f06a7374b81

lib/redmine/scm/adapters/cvs_adapter.rb
test/unit/lib/redmine/scm/adapters/cvs_adapter_test.rb

index 3a0d27c34e8b2bfb5cfefbd4a83abcf05945a666..d1096e7251c66eac87a7e9320876d10fd979d984 100644 (file)
@@ -335,7 +335,7 @@ module Redmine
         # :pserver:anonymous@foo.bar:/path => /path
         # :ext:cvsservername:/path => /path
         def root_url_path
-          root_url.to_s.gsub(/^:.+:\d*/, '')
+          root_url.to_s.gsub(%r{^:.+?(?=/)}, '')
         end
 
         # convert a date/time into the CVS-format
index fd931316e481f8da7b422aa1a651b8592e2a6cf9..d9ca7af0c3ff12ff1a9115ee627305f70b1aaa6e 100644 (file)
@@ -80,8 +80,19 @@ begin
       end
 
       def test_root_url_path
-        adapter = Redmine::Scm::Adapters::CvsAdapter.new('foo', ':pserver:cvs_user:cvs_password@123.456.789.123:9876/repo')
-        assert_equal '/repo', adapter.send(:root_url_path)
+        to_test = {
+          ':pserver:cvs_user:cvs_password@123.456.789.123:9876/repo' => '/repo',
+          ':pserver:cvs_user:cvs_password@123.456.789.123/repo' => '/repo',
+          ':pserver:cvs_user:cvs_password@cvs_server:/repo' => '/repo',
+          ':pserver:cvs_user:cvs_password@cvs_server:9876/repo' => '/repo',
+          ':pserver:cvs_user:cvs_password@cvs_server/repo' => '/repo',
+          ':pserver:cvs_user:cvs_password@cvs_server/path/repo' => '/path/repo',
+          ':ext:cvsservername:/path' => '/path'
+        }
+
+        to_test.each do |string, expected|
+          assert_equal expected, Redmine::Scm::Adapters::CvsAdapter.new('foo', string).send(:root_url_path), "#{string} failed"
+        end
       end
 
       private