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
64fe954d
Commit
64fe954d
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 renaming a repository
parent
9504a529
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
1 deletion
+20
-1
app/models/project.rb
app/models/project.rb
+5
-0
spec/models/project_spec.rb
spec/models/project_spec.rb
+14
-0
spec/services/projects/update_service_spec.rb
spec/services/projects/update_service_spec.rb
+1
-1
No files found.
app/models/project.rb
View file @
64fe954d
...
@@ -1420,6 +1420,11 @@ class Project < ActiveRecord::Base
...
@@ -1420,6 +1420,11 @@ class Project < ActiveRecord::Base
end
end
def
after_rename_repo
def
after_rename_repo
# 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.
write_repository_config
(
:fullpath
,
full_path
)
path_before_change
=
previous_changes
[
'path'
].
first
path_before_change
=
previous_changes
[
'path'
].
first
# We need to check if project had been rolled out to move resource to hashed storage or not and decide
# We need to check if project had been rolled out to move resource to hashed storage or not and decide
...
...
spec/models/project_spec.rb
View file @
64fe954d
...
@@ -2626,6 +2626,14 @@ describe Project do
...
@@ -2626,6 +2626,14 @@ describe Project do
project
.
rename_repo
project
.
rename_repo
end
end
end
end
it
'updates project full path in .git/config'
do
allow
(
project_storage
).
to
receive
(
:rename_repo
).
and_return
(
true
)
expect
(
project
).
to
receive
(
:write_repository_config
).
with
(
:fullpath
,
project
.
full_path
)
project
.
rename_repo
end
end
end
describe
'#pages_path'
do
describe
'#pages_path'
do
...
@@ -2781,6 +2789,12 @@ describe Project do
...
@@ -2781,6 +2789,12 @@ describe Project do
end
end
end
end
end
end
it
'updates project full path in .git/config'
do
expect
(
project
).
to
receive
(
:write_repository_config
).
with
(
:fullpath
,
project
.
full_path
)
project
.
rename_repo
end
end
end
describe
'#pages_path'
do
describe
'#pages_path'
do
...
...
spec/services/projects/update_service_spec.rb
View file @
64fe954d
...
@@ -61,7 +61,7 @@ describe Projects::UpdateService do
...
@@ -61,7 +61,7 @@ describe Projects::UpdateService do
end
end
end
end
context
'
W
hen project visibility is higher than parent group'
do
context
'
w
hen project visibility is higher than parent group'
do
let
(
:group
)
{
create
(
:group
,
visibility_level:
Gitlab
::
VisibilityLevel
::
INTERNAL
)
}
let
(
:group
)
{
create
(
:group
,
visibility_level:
Gitlab
::
VisibilityLevel
::
INTERNAL
)
}
before
do
before
do
...
...
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