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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
e6501b57
Commit
e6501b57
authored
Jun 19, 2016
by
Paco Guzman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
UpdateMirror service return an error status when no mirror
parent
d777b87b
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
1 deletion
+16
-1
CHANGELOG-EE
CHANGELOG-EE
+1
-0
app/services/projects/update_mirror_service.rb
app/services/projects/update_mirror_service.rb
+3
-1
spec/services/projects/update_mirror_service_spec.rb
spec/services/projects/update_mirror_service_spec.rb
+12
-0
No files found.
CHANGELOG-EE
View file @
e6501b57
...
...
@@ -10,6 +10,7 @@ v 8.9.0 (unreleased)
- Distribute RepositoryUpdateMirror jobs in time and add exclusive lease on them by project_id
- [Elastic] Move ES settings to application settings
- Disable mirror flag for projects without import_url
- UpdateMirror service return an error status when no mirror
- Show flash notice when Git Hooks are updated successfully
- [Elastic] Project members with guest role can't access confidential issues
- Ability to lock file or folder in the repository
...
...
app/services/projects/update_mirror_service.rb
View file @
e6501b57
...
...
@@ -4,7 +4,9 @@ module Projects
class
UpdateError
<
Error
;
end
def
execute
return
false
unless
project
.
mirror?
unless
project
.
mirror?
return
error
(
"The project has no mirror to update"
)
end
unless
can?
(
current_user
,
:push_code_to_protected_branches
,
project
)
return
error
(
"The mirror user is not allowed to push code to all branches on this project."
)
...
...
spec/services/projects/update_mirror_service_spec.rb
View file @
e6501b57
...
...
@@ -73,6 +73,18 @@ describe Projects::UpdateMirrorService do
expect
(
result
[
:status
]).
to
eq
(
:error
)
end
end
describe
"when is no mirror"
do
let
(
:project
)
{
build_stubbed
(
:project
)
}
it
"fails"
do
expect
(
project
.
mirror?
).
to
eq
(
false
)
result
=
described_class
.
new
(
project
,
build_stubbed
(
:user
)).
execute
expect
(
result
[
:status
]).
to
eq
(
:error
)
end
end
end
def
stub_fetch_mirror
(
project
,
repository:
project
.
repository
)
...
...
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