Extend Subversion repository with UTF-8 paths (#4326)

Provide some test data for UTF-8 encoded paths with Subversion.
This confirms the tests of PR #4324.

Side note:
OS X will decompose some unicode characters into two characters.
For example, the LATIN SMALL LETTER O WITH DIAERESIS (U+00F6 `ö`) will be
decomposed into o and COMBINING DIAERESIS (U+0308).

This obviously breaks SVN path mapping and while you will be able to
commit files with decomposed paths, it will wreak havoc when using these
characters on repositories manipulated by OSX and other systems.
It apepars that Windows, Linux silently ignore these changes.

We can't really account for this server side, but unicode-path patches exists for Subversion on OSX.
For git, a config setting exists that does just that (`core.precomposeunicode`).
pull/4342/head
Oliver Günther 9 years ago
parent 9fc459de7d
commit 8fd75e0456
  1. 42
      spec/controllers/repositories_controller_spec.rb
  2. BIN
      spec/fixtures/repositories/subversion_repository.dump.gz
  3. BIN
      spec/fixtures/repositories/subversion_repository.tar.gz
  4. 24
      spec/lib/open_project/scm/adapters/subversion_adapter_spec.rb
  5. 8
      spec/models/repository/subversion_spec.rb
  6. 8
      spec_legacy/unit/repository_subversion_spec.rb

@ -1,3 +1,4 @@
#-- encoding: UTF-8
#-- copyright
# OpenProject is a project management system.
# Copyright (C) 2012-2015 the OpenProject Foundation (OPF)
@ -252,24 +253,49 @@ describe RepositoriesController, type: :controller do
end
end
shared_examples 'renders the repository title' do |active_breadcrumb|
it do
expect(response).to be_success
expect(response.body).to have_selector('.repository-breadcrumbs', text: active_breadcrumb)
end
end
describe 'show' do
render_views
let(:role) { FactoryGirl.create(:role, permissions: [:browse_repository]) }
before do
get :show, project_id: project.identifier, path: path
end
shared_examples 'renders the repository' do |active_breadcrumb|
it do
expect(response).to be_success
expect(response.body).to have_selector('.repository-breadcrumbs', text: active_breadcrumb)
end
context 'with brackets' do
let(:path) { 'subversion_test/[folder_with_brackets]' }
it_behaves_like 'renders the repository title', '[folder_with_brackets]'
end
context 'with special characters' do
context 'with unicode' do
let(:path) { 'Föbar/äm/Sägepütz!%5D§' }
it_behaves_like 'renders the repository title', 'Sägepütz!%5D§'
end
end
describe 'changes' do
render_views
let(:role) { FactoryGirl.create(:role, permissions: [:browse_repository]) }
before do
get :changes, project_id: project.identifier, path: path
expect(response).to be_success
end
context 'with brackets' do
let(:path) { 'subversion_test/[folder_with_brackets]' }
it_behaves_like 'renders the repository', '[folder_with_brackets]'
it_behaves_like 'renders the repository title', '[folder_with_brackets]'
end
context 'with unicode' do
let(:path) { 'Föbar/äm' }
it_behaves_like 'renders the repository title', 'äm'
end
end

@ -187,30 +187,32 @@ describe OpenProject::Scm::Adapters::Subversion do
it 'builds the info object' do
info = adapter.info
expect(info.root_url).to eq(url)
expect(info.lastrev.identifier).to eq('12')
expect(info.lastrev.identifier).to eq('13')
expect(info.lastrev.author).to eq('oliver')
expect(info.lastrev.time).to eq('2015-07-08T13:32:29.228572Z')
expect(info.lastrev.time).to eq('2016-04-14T19:23:01.74469Z')
end
end
describe '.entries' do
it 'reads all entries from the current revision' do
entries = adapter.entries
expect(entries.length).to eq(1)
expect(entries.length).to eq(2)
expect(entries[0].name).to eq('subversion_test')
expect(entries[0].path).to eq('subversion_test')
expect(entries[0].name).to eq('Föbar')
expect(entries[0].path).to eq('Föbar')
expect(entries[1].name).to eq('subversion_test')
expect(entries[1].path).to eq('subversion_test')
end
it 'contains a reference to the last revision' do
entries = adapter.entries
expect(entries.length).to eq(1)
expect(entries.length).to eq(2)
lastrev = entries[0].lastrev
expect(lastrev.identifier).to eq('12')
expect(lastrev.identifier).to eq('13')
expect(lastrev.author).to eq('oliver')
expect(lastrev.message).to eq('')
expect(lastrev.time).to eq('2015-07-08T13:32:29.228572Z')
expect(lastrev.time).to eq('2016-04-14T19:23:01.74469Z')
end
it 'reads all entries from the given revision' do
@ -282,13 +284,13 @@ describe OpenProject::Scm::Adapters::Subversion do
describe '.revisions' do
it 'returns all revisions by default' do
revisions = adapter.revisions
expect(revisions.length).to eq(12)
expect(revisions.length).to eq(13)
expect(revisions[0].author).to eq('oliver')
expect(revisions[0].message).to eq("Propedit\n")
expect(revisions[0].message).to eq("UTF-8 Test")
revisions.each_with_index do |rev, i|
expect(rev.identifier).to eq((12 - i).to_s)
expect(rev.identifier).to eq((13 - i).to_s)
end
end

@ -161,8 +161,8 @@ describe Repository::Subversion, type: :model do
instance.fetch_changesets
instance.reload
expect(instance.changesets.count).to eq(12)
expect(instance.file_changes.count).to eq(21)
expect(instance.changesets.count).to eq(13)
expect(instance.file_changes.count).to eq(25)
expect(instance.changesets.find_by(revision: '1').comments).to eq('Initial import.')
end
@ -175,7 +175,7 @@ describe Repository::Subversion, type: :model do
expect(instance.changesets.count).to eq(5)
instance.fetch_changesets
expect(instance.changesets.count).to eq(12)
expect(instance.changesets.count).to eq(13)
end
it 'should latest changesets' do
@ -289,7 +289,7 @@ describe Repository::Subversion, type: :model do
changeset = instance.find_changeset_by_name('1')
expect(changeset.previous).to be_nil
changeset = instance.find_changeset_by_name('12')
changeset = instance.find_changeset_by_name('13')
expect(changeset.next).to be_nil
end

@ -45,8 +45,8 @@ describe Repository::Subversion, type: :model do
@repository.fetch_changesets
@repository.reload
assert_equal 12, @repository.changesets.count
assert_equal 21, @repository.file_changes.count
assert_equal 13, @repository.changesets.count
assert_equal 25, @repository.file_changes.count
assert_equal 'Initial import.', @repository.changesets.find_by(revision: '1').comments
end
@ -58,7 +58,7 @@ describe Repository::Subversion, type: :model do
assert_equal 5, @repository.changesets.count
@repository.fetch_changesets
assert_equal 12, @repository.changesets.count
assert_equal 13, @repository.changesets.count
end
it 'should latest changesets' do
@ -199,7 +199,7 @@ describe Repository::Subversion, type: :model do
it 'should next nil' do
@repository.fetch_changesets
@repository.reload
changeset = @repository.find_changeset_by_name('12')
changeset = @repository.find_changeset_by_name('13')
assert_nil changeset.next
end

Loading…
Cancel
Save