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
Léo-Paul Géneau
gitlab-ce
Commits
bd903307
Commit
bd903307
authored
Dec 19, 2017
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update project full path in .git/config when transfering a project
parent
64fe954d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
0 deletions
+22
-0
app/services/projects/transfer_service.rb
app/services/projects/transfer_service.rb
+10
-0
spec/services/projects/transfer_service_spec.rb
spec/services/projects/transfer_service_spec.rb
+12
-0
No files found.
app/services/projects/transfer_service.rb
View file @
bd903307
...
@@ -75,6 +75,8 @@ module Projects
...
@@ -75,6 +75,8 @@ module Projects
project
.
old_path_with_namespace
=
@old_path
project
.
old_path_with_namespace
=
@old_path
project
.
expires_full_path_cache
project
.
expires_full_path_cache
write_repository_config
(
@new_path
)
execute_system_hooks
execute_system_hooks
end
end
rescue
Exception
# rubocop:disable Lint/RescueException
rescue
Exception
# rubocop:disable Lint/RescueException
...
@@ -98,6 +100,13 @@ module Projects
...
@@ -98,6 +100,13 @@ module Projects
project
.
save!
project
.
save!
end
end
def
write_repository_config
(
full_path
)
# We'd need to keep track of project full path otherwise directory tree
# created with hashed storage enabled cannot be usefully imported using
# the import rake task.
project
.
write_repository_config
(
:fullpath
,
full_path
)
end
def
refresh_permissions
def
refresh_permissions
# This ensures we only schedule 1 job for every user that has access to
# This ensures we only schedule 1 job for every user that has access to
# the namespaces.
# the namespaces.
...
@@ -110,6 +119,7 @@ module Projects
...
@@ -110,6 +119,7 @@ module Projects
def
rollback_side_effects
def
rollback_side_effects
rollback_folder_move
rollback_folder_move
update_namespace_and_visibility
(
@old_namespace
)
update_namespace_and_visibility
(
@old_namespace
)
write_repository_config
(
@old_path
)
end
end
def
rollback_folder_move
def
rollback_folder_move
...
...
spec/services/projects/transfer_service_spec.rb
View file @
bd903307
...
@@ -54,6 +54,12 @@ describe Projects::TransferService do
...
@@ -54,6 +54,12 @@ describe Projects::TransferService do
expect
(
project
.
disk_path
).
not_to
eq
(
old_path
)
expect
(
project
.
disk_path
).
not_to
eq
(
old_path
)
expect
(
project
.
disk_path
).
to
start_with
(
group
.
path
)
expect
(
project
.
disk_path
).
to
start_with
(
group
.
path
)
end
end
it
'updates project full path in .git/config'
do
transfer_project
(
project
,
user
,
group
)
expect
(
project
.
repo
.
config
[
'gitlab.fullpath'
]).
to
eq
"
#{
group
.
full_path
}
/
#{
project
.
path
}
"
end
end
end
context
'when transfer fails'
do
context
'when transfer fails'
do
...
@@ -86,6 +92,12 @@ describe Projects::TransferService do
...
@@ -86,6 +92,12 @@ describe Projects::TransferService do
expect
(
original_path
).
to
eq
current_path
expect
(
original_path
).
to
eq
current_path
end
end
it
'rolls back project full path in .git/config'
do
attempt_project_transfer
expect
(
project
.
repo
.
config
[
'gitlab.fullpath'
]).
to
eq
project
.
full_path
end
it
"doesn't send move notifications"
do
it
"doesn't send move notifications"
do
expect_any_instance_of
(
NotificationService
).
not_to
receive
(
:project_was_moved
)
expect_any_instance_of
(
NotificationService
).
not_to
receive
(
:project_was_moved
)
...
...
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