Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
3bb103f2
Commit
3bb103f2
authored
Nov 25, 2017
by
digitalMoksha
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactored the hashed repository name
parent
02dd3b4e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
2 deletions
+5
-2
lib/tasks/gitlab/cleanup.rake
lib/tasks/gitlab/cleanup.rake
+5
-2
No files found.
lib/tasks/gitlab/cleanup.rake
View file @
3bb103f2
namespace
:gitlab
do
namespace
:gitlab
do
namespace
:cleanup
do
namespace
:cleanup
do
HASHED_REPOSITORY_NAME
=
'@hashed'
desc
"GitLab | Cleanup | Clean namespaces"
desc
"GitLab | Cleanup | Clean namespaces"
task
dirs: :environment
do
task
dirs: :environment
do
warn_user_is_not_gitlab
warn_user_is_not_gitlab
remove_flag
=
ENV
[
'REMOVE'
]
remove_flag
=
ENV
[
'REMOVE'
]
namespaces
=
Namespace
.
pluck
(
:path
)
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
|
Gitlab
.
config
.
repositories
.
storages
.
each
do
|
name
,
repository_storage
|
git_base_path
=
repository_storage
[
'path'
]
git_base_path
=
repository_storage
[
'path'
]
all_dirs
=
Dir
.
glob
(
git_base_path
+
'/*'
)
all_dirs
=
Dir
.
glob
(
git_base_path
+
'/*'
)
...
@@ -63,7 +66,7 @@ namespace :gitlab do
...
@@ -63,7 +66,7 @@ namespace :gitlab do
# TODO ignoring hashed repositories for now. But revisit to fully support
# TODO ignoring hashed repositories for now. But revisit to fully support
# possible orphaned hashed repos
# 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
new_path
=
path
+
move_suffix
puts
path
.
inspect
+
' -> '
+
new_path
.
inspect
puts
path
.
inspect
+
' -> '
+
new_path
.
inspect
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment