summaryrefslogtreecommitdiff
path: root/app/models/project.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/project.rb')
-rw-r--r--app/models/project.rb14
1 files changed, 13 insertions, 1 deletions
diff --git a/app/models/project.rb b/app/models/project.rb
index 4628f478ca6..3dc1729e812 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -520,6 +520,14 @@ class Project < ActiveRecord::Base
!repository.exists? || repository.empty?
end
+ def ensure_satellite_exists
+ self.satellite.create unless self.satellite.exists?
+ end
+
+ def satellite
+ @satellite ||= Gitlab::Satellite::Satellite.new(self)
+ end
+
def repo
repository.raw
end
@@ -589,11 +597,14 @@ class Project < ActiveRecord::Base
new_path_with_namespace = File.join(namespace_dir, path)
if gitlab_shell.mv_repository(old_path_with_namespace, new_path_with_namespace)
- # If repository moved successfully we need to send update instructions to users.
+ # If repository moved successfully we need to remove old satellite
+ # and send update instructions to users.
# However we cannot allow rollback since we moved repository
# So we basically we mute exceptions in next actions
begin
gitlab_shell.mv_repository("#{old_path_with_namespace}.wiki", "#{new_path_with_namespace}.wiki")
+ gitlab_shell.rm_satellites(old_path_with_namespace)
+ ensure_satellite_exists
send_move_instructions
reset_events_cache
rescue
@@ -691,6 +702,7 @@ class Project < ActiveRecord::Base
def create_repository
if forked?
if gitlab_shell.fork_repository(forked_from_project.path_with_namespace, self.namespace.path)
+ ensure_satellite_exists
true
else
errors.add(:base, 'Failed to fork repository via gitlab-shell')