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
b82f6d4c
Commit
b82f6d4c
authored
Apr 01, 2020
by
Doug Stull
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Check for file existance in source branch
parent
7fc6a442
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
4 deletions
+4
-4
app/serializers/merge_request_widget_entity.rb
app/serializers/merge_request_widget_entity.rb
+1
-1
spec/serializers/merge_request_widget_entity_spec.rb
spec/serializers/merge_request_widget_entity_spec.rb
+3
-3
No files found.
app/serializers/merge_request_widget_entity.rb
View file @
b82f6d4c
...
...
@@ -96,8 +96,8 @@ class MergeRequestWidgetEntity < Grape::Entity
def
can_add_ci_config_path?
(
merge_request
)
merge_request
.
source_project
&
.
uses_default_ci_config?
&&
merge_request
.
all_pipelines
.
none?
&&
merge_request
.
commits_count
.
positive?
&&
!
merge_request
.
source_project
.
repository
.
blob_at
(
merge_request
.
source_branch
,
Gitlab
::
FileDetector
::
PATTERNS
[
:gitlab_ci
])
&&
can?
(
current_user
,
:read_build
,
merge_request
.
source_project
)
&&
can?
(
current_user
,
:create_pipeline
,
merge_request
.
source_project
)
end
...
...
spec/serializers/merge_request_widget_entity_spec.rb
View file @
b82f6d4c
...
...
@@ -58,11 +58,11 @@ describe MergeRequestWidgetEntity do
project
.
add_role
(
user
,
role
)
end
context
'when there
are pipelines
'
do
context
'when there
is a standard ci config file in the source project
'
do
let
(
:role
)
{
:developer
}
before
do
create
(
:ci_empty_pipeline
,
project:
project
,
sha:
resource
.
all_commit_shas
.
first
,
ref:
resource
.
source_branch
)
project
.
repository
.
create_file
(
user
,
Gitlab
::
FileDetector
::
PATTERNS
[
:gitlab_ci
],
'CONTENT'
,
message:
'Add .gitlab-ci.yml'
,
branch_name:
'master'
)
end
it
'no ci config path'
do
...
...
@@ -70,7 +70,7 @@ describe MergeRequestWidgetEntity do
end
end
context
'when there
are no pipelines
'
do
context
'when there
is no standard ci config file in the source project
'
do
context
'when user has permissions'
do
let
(
:role
)
{
:developer
}
...
...
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