summaryrefslogtreecommitdiff
path: root/app/models/namespace.rb
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2017-01-24 21:52:54 +0100
committerKamil Trzcinski <ayufan@ayufan.eu>2017-01-24 21:52:54 +0100
commitac92554dfc25fc8129b1972da9a385af8d8b733f (patch)
tree14edbdb3f0479d8fad44e18eecebdc10285ffaee /app/models/namespace.rb
parentb7f4553e3e4681d5a4a53af35650bcbb1c83b390 (diff)
parent8c9a06c37c4cf9763b3781d7e567a7b442c2152c (diff)
downloadgitlab-ce-ac92554dfc25fc8129b1972da9a385af8d8b733f.tar.gz
Merge remote-tracking branch 'origin/master' into backport-ee-changes-for-build-minutes
Diffstat (limited to 'app/models/namespace.rb')
-rw-r--r--app/models/namespace.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/app/models/namespace.rb b/app/models/namespace.rb
index 778b9c127ad..296729b0835 100644
--- a/app/models/namespace.rb
+++ b/app/models/namespace.rb
@@ -131,6 +131,8 @@ class Namespace < ActiveRecord::Base
Gitlab::UploadsTransfer.new.rename_namespace(path_was, path)
+ remove_exports!
+
# If repositories moved successfully we need to
# send update instructions to users.
# However we cannot allow rollback since we moved namespace dir
@@ -219,6 +221,8 @@ class Namespace < ActiveRecord::Base
GitlabShellWorker.perform_in(5.minutes, :rm_namespace, repository_storage_path, new_path)
end
end
+
+ remove_exports!
end
def refresh_access_of_projects_invited_groups
@@ -231,4 +235,20 @@ class Namespace < ActiveRecord::Base
def full_path_changed?
path_changed? || parent_id_changed?
end
+
+ def remove_exports!
+ Gitlab::Popen.popen(%W(find #{export_path} -not -path #{export_path} -delete))
+ end
+
+ def export_path
+ File.join(Gitlab::ImportExport.storage_path, full_path_was)
+ end
+
+ def full_path_was
+ if parent
+ parent.full_path + '/' + path_was
+ else
+ path_was
+ end
+ end
end