]> source.dussan.org Git - redmine.git/commitdiff
Extend changes.path and changes.from_path to support longer paths. #5771
authorEric Davis <edavis@littlestreamsoftware.com>
Tue, 6 Jul 2010 02:07:46 +0000 (02:07 +0000)
committerEric Davis <edavis@littlestreamsoftware.com>
Tue, 6 Jul 2010 02:07:46 +0000 (02:07 +0000)
Long paths to SCM files would be truncated or wouldn't insert into some
databases.  This extends those fields to support arbitrary length filenames.

Contributed by Holger Just

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3828 e93f8b46-1217-0410-a6f0-8f06a7374b81

db/migrate/20100705164950_change_changes_path_length_limit.rb [new file with mode: 0644]
test/fixtures/repositories/git_repository.tar.gz
test/functional/repositories_git_controller_test.rb
test/unit/lib/redmine/scm/adapters/git_adapter_test.rb
test/unit/repository_git_test.rb

diff --git a/db/migrate/20100705164950_change_changes_path_length_limit.rb b/db/migrate/20100705164950_change_changes_path_length_limit.rb
new file mode 100644 (file)
index 0000000..5f34d5d
--- /dev/null
@@ -0,0 +1,11 @@
+class ChangeChangesPathLengthLimit < ActiveRecord::Migration
+  def self.up
+    change_column :changes, :path, :text, :default => "", :null => false
+    change_column :changes, :from_path, :text
+  end
+
+  def self.down
+    change_column :changes, :path, :string, :default => "", :null => false
+    change_column :changes, :from_path, :string
+  end
+end
index 48966da30bf58b5d804ee9b51deb0dcce9da4edb..8158d583244a12064c1d48d20eb64427d56d3159 100644 (file)
Binary files a/test/fixtures/repositories/git_repository.tar.gz and b/test/fixtures/repositories/git_repository.tar.gz differ
index 37c6fb848297a4a5c74b1c405e8127911a294d4f..317261a13d63988496301f9b2470437d51c7940b 100644 (file)
@@ -50,8 +50,9 @@ class RepositoriesGitControllerTest < ActionController::TestCase
       assert_response :success
       assert_template 'show'
       assert_not_nil assigns(:entries)
-      assert_equal 6, assigns(:entries).size
+      assert_equal 7, assigns(:entries).size
       assert assigns(:entries).detect {|e| e.name == 'images' && e.kind == 'dir'}
+      assert assigns(:entries).detect {|e| e.name == 'this_is_a_really_long_and_verbose_directory_name' && e.kind == 'dir'}
       assert assigns(:entries).detect {|e| e.name == 'sources' && e.kind == 'dir'}
       assert assigns(:entries).detect {|e| e.name == 'README' && e.kind == 'file'}
       assert assigns(:entries).detect {|e| e.name == 'copied_README' && e.kind == 'file'}
index e3c633749788d18ec78ebf7e97fe25261b978d50..2dc5d3e8e63f4b6ccd3c8a6e1c4be19f24fec8cc 100644 (file)
@@ -13,7 +13,7 @@ class GitAdapterTest < ActiveSupport::TestCase
     end
 
     def test_getting_all_revisions
-      assert_equal 12, @adapter.revisions('',nil,nil,:all => true).length
+      assert_equal 13, @adapter.revisions('',nil,nil,:all => true).length
     end
     
     def test_annotate
index 71b3e4da547b6248449e4e794abef6dd07f194ed..dad5610aee8b3ca008f1030ea91b3fa4a5642dd7 100644 (file)
@@ -34,8 +34,8 @@ class RepositoryGitTest < ActiveSupport::TestCase
       @repository.fetch_changesets
       @repository.reload
       
-      assert_equal 12, @repository.changesets.count
-      assert_equal 21, @repository.changes.count
+      assert_equal 13, @repository.changesets.count
+      assert_equal 22, @repository.changes.count
       
       commit = @repository.changesets.find(:first, :order => 'committed_on ASC')
       assert_equal "Initial import.\nThe repository contains 3 files.", commit.comments
@@ -57,10 +57,10 @@ class RepositoryGitTest < ActiveSupport::TestCase
       # Remove the 3 latest changesets
       @repository.changesets.find(:all, :order => 'committed_on DESC', :limit => 3).each(&:destroy)
       @repository.reload
-      assert_equal 9, @repository.changesets.count
+      assert_equal 10, @repository.changesets.count
       
       @repository.fetch_changesets
-      assert_equal 12, @repository.changesets.count
+      assert_equal 13, @repository.changesets.count
     end
   else
     puts "Git test repository NOT FOUND. Skipping unit tests !!!"