diff options
-rw-r--r-- | app/controllers/repositories_controller.rb | 2 | ||||
-rw-r--r-- | test/functional/repositories_controller_test.rb | 25 |
2 files changed, 26 insertions, 1 deletions
diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index 2912b72bf..77b74bfe3 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -111,7 +111,7 @@ class RepositoriesController < ApplicationController end def show - @repository.fetch_changesets if Setting.autofetch_changesets? && @path.empty? + @repository.fetch_changesets if @project.active? && Setting.autofetch_changesets? && @path.empty? @entries = @repository.entries(@path, @rev) @changeset = @repository.find_changeset_by_name(@rev) diff --git a/test/functional/repositories_controller_test.rb b/test/functional/repositories_controller_test.rb index 315090c59..2231e3134 100644 --- a/test/functional/repositories_controller_test.rb +++ b/test/functional/repositories_controller_test.rb @@ -111,6 +111,31 @@ class RepositoriesControllerTest < ActionController::TestCase assert_nil Repository.find_by_id(11) end + def test_show_with_autofetch_changesets_enabled_should_fetch_changesets + Repository::Subversion.any_instance.expects(:fetch_changesets).once + + with_settings :autofetch_changesets => '1' do + get :show, :id => 1 + end + end + + def test_show_with_autofetch_changesets_disabled_should_not_fetch_changesets + Repository::Subversion.any_instance.expects(:fetch_changesets).never + + with_settings :autofetch_changesets => '0' do + get :show, :id => 1 + end + end + + def test_show_with_closed_project_should_not_fetch_changesets + Repository::Subversion.any_instance.expects(:fetch_changesets).never + Project.find(1).close + + with_settings :autofetch_changesets => '1' do + get :show, :id => 1 + end + end + def test_revisions get :revisions, :id => 1 assert_response :success |