summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordigitalMoksha <bwalker@gitlab.com>2017-11-25 14:23:41 +0100
committerdigitalMoksha <bwalker@gitlab.com>2017-11-25 14:23:41 +0100
commit3bb103f28272bae4b541a3291d3ebd8396f97ca0 (patch)
treed4d0fa7a4bab6c9ea6000ff20f55fb4e5cc0b43c
parent02dd3b4ed1e15b37aad224ea3a36fc3606fa013d (diff)
downloadgitlab-ce-3bb103f28272bae4b541a3291d3ebd8396f97ca0.tar.gz
refactored the hashed repository name
-rw-r--r--lib/tasks/gitlab/cleanup.rake7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/tasks/gitlab/cleanup.rake b/lib/tasks/gitlab/cleanup.rake
index 111576ea802..e3a18b327dd 100644
--- a/lib/tasks/gitlab/cleanup.rake
+++ b/lib/tasks/gitlab/cleanup.rake
@@ -1,12 +1,15 @@
namespace :gitlab do
namespace :cleanup do
+
+ HASHED_REPOSITORY_NAME = '@hashed'
+
desc "GitLab | Cleanup | Clean namespaces"
task dirs: :environment do
warn_user_is_not_gitlab
remove_flag = ENV['REMOVE']
namespaces = Namespace.pluck(:path)
- namespaces << '@hashed' # add so that it will be ignored
+ namespaces << HASHED_REPOSITORY_NAME # add so that it will be ignored
Gitlab.config.repositories.storages.each do |name, repository_storage|
git_base_path = repository_storage['path']
all_dirs = Dir.glob(git_base_path + '/*')
@@ -63,7 +66,7 @@ namespace :gitlab do
# TODO ignoring hashed repositories for now. But revisit to fully support
# possible orphaned hashed repos
- next if repo_with_namespace.start_with?('@hashed/') || Project.find_by_full_path(repo_with_namespace)
+ next if repo_with_namespace.start_with?("#{HASHED_REPOSITORY_NAME}/") || Project.find_by_full_path(repo_with_namespace)
new_path = path + move_suffix
puts path.inspect + ' -> ' + new_path.inspect