summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel Mazetto <brodock@gmail.com>2017-08-08 11:53:52 +0200
committerGabriel Mazetto <brodock@gmail.com>2017-08-22 06:33:20 +0200
commit95a270c87104e1225d4c29a54611f5e4f7a76b56 (patch)
tree97b3d0033d1d0efa5a1dc64adab530b71ae3d8c5
parent47d3ea01bbc197e6ec8c566f287961cef2ec1cb6 (diff)
downloadgitlab-ce-95a270c87104e1225d4c29a54611f5e4f7a76b56.tar.gz
Fix repository reloading in some specs
-rw-r--r--app/models/project.rb4
-rw-r--r--app/models/storage/hashed_project.rb4
-rw-r--r--app/models/storage/legacy_project.rb4
3 files changed, 8 insertions, 4 deletions
diff --git a/app/models/project.rb b/app/models/project.rb
index 5f510412015..b84d06fef1e 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -478,6 +478,10 @@ class Project < ActiveRecord::Base
@repository ||= Repository.new(full_path, self, disk_path: disk_path)
end
+ def reload_repository!
+ @repository = nil
+ end
+
def container_registry_url
if Gitlab.config.registry.enabled
"#{Gitlab.config.registry.host_port}/#{full_path.downcase}"
diff --git a/app/models/storage/hashed_project.rb b/app/models/storage/hashed_project.rb
index 364794a4eef..91f74b084b6 100644
--- a/app/models/storage/hashed_project.rb
+++ b/app/models/storage/hashed_project.rb
@@ -47,11 +47,11 @@ module Storage
project.send_move_instructions(old_path_with_namespace)
- @old_path_with_namespace = old_path_with_namespace
+ project.old_path_with_namespace = old_path_with_namespace
SystemHooksService.new.execute_hooks_for(project, :rename)
- @repository = nil
+ project.reload_repository!
rescue => e
Rails.logger.error "Exception renaming #{old_path_with_namespace} -> #{new_path_with_namespace}: #{e}"
# Returning false does not rollback after_* transaction but gives
diff --git a/app/models/storage/legacy_project.rb b/app/models/storage/legacy_project.rb
index 57c340075ba..b7b073ad077 100644
--- a/app/models/storage/legacy_project.rb
+++ b/app/models/storage/legacy_project.rb
@@ -52,11 +52,11 @@ module Storage
project.send_move_instructions(old_path_with_namespace)
project.expires_full_path_cache
- @old_path_with_namespace = old_path_with_namespace
+ project.old_path_with_namespace = old_path_with_namespace
SystemHooksService.new.execute_hooks_for(project, :rename)
- @repository = nil
+ project.reload_repository!
rescue => e
Rails.logger.error "Exception renaming #{old_path_with_namespace} -> #{new_path_with_namespace}: #{e}"
# Returning false does not rollback after_* transaction but gives