summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJacob Vosmaer <contact@jacobvosmaer.nl>2015-09-15 17:07:51 +0200
committerJacob Vosmaer <contact@jacobvosmaer.nl>2015-09-15 17:07:51 +0200
commited38627ec55ce4c3352f44167c4fc75c59841315 (patch)
treef278f8d8018a37fca276a69a281dc30fe846b5ab /lib
parent52d7813f2eb554d82b6c435a3207fc2e59c76e70 (diff)
downloadgitlab-ce-ed38627ec55ce4c3352f44167c4fc75c59841315.tar.gz
Guard against trailing slashes in repos_path
Diffstat (limited to 'lib')
-rw-r--r--lib/tasks/gitlab/cleanup.rake6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/tasks/gitlab/cleanup.rake b/lib/tasks/gitlab/cleanup.rake
index f97d4b86e0f..9f5852ac613 100644
--- a/lib/tasks/gitlab/cleanup.rake
+++ b/lib/tasks/gitlab/cleanup.rake
@@ -53,7 +53,11 @@ namespace :gitlab do
IO.popen(%W(find #{repo_root} -mindepth 1 -maxdepth 2 -name *.git)) do |find|
find.each_line do |path|
path.chomp!
- repo_with_namespace = path.sub(repo_root + '/', '').chomp('.git').chomp('.wiki')
+ repo_with_namespace = path.
+ sub(repo_root, '').
+ sub(%r{^/*}, '').
+ chomp('.git').
+ chomp('.wiki')
next if Project.find_with_namespace(repo_with_namespace)
new_path = path + move_suffix
puts path.inspect + ' -> ' + new_path.inspect