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
2d8d94a7
Commit
2d8d94a7
authored
Aug 30, 2016
by
Katarzyna Kobierska
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change method name
parent
72266311
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
14 deletions
+8
-14
CHANGELOG
CHANGELOG
+1
-7
app/models/merge_request.rb
app/models/merge_request.rb
+3
-3
spec/models/merge_request_spec.rb
spec/models/merge_request_spec.rb
+4
-4
No files found.
CHANGELOG
View file @
2d8d94a7
...
@@ -40,6 +40,7 @@ v 8.12.0 (unreleased)
...
@@ -40,6 +40,7 @@ v 8.12.0 (unreleased)
- Use the default branch for displaying the project icon instead of master !5792 (Hannes Rosenögger)
- Use the default branch for displaying the project icon instead of master !5792 (Hannes Rosenögger)
- Adds response mime type to transaction metric action when it's not HTML
- Adds response mime type to transaction metric action when it's not HTML
- Fix hover leading space bug in pipeline graph !5980
- Fix hover leading space bug in pipeline graph !5980
- User can edit closed MR with deleted fork (Katarzyna Kobierska Ula Budziszewska) !5496
v 8.11.3 (unreleased)
v 8.11.3 (unreleased)
- Allow system info page to handle case where info is unavailable
- Allow system info page to handle case where info is unavailable
...
@@ -53,13 +54,6 @@ v 8.11.2
...
@@ -53,13 +54,6 @@ v 8.11.2
- Show "Create Merge Request" widget for push events to fork projects on the source project. !5978
- Show "Create Merge Request" widget for push events to fork projects on the source project. !5978
- Use gitlab-workhorse 0.7.11 !5983
- Use gitlab-workhorse 0.7.11 !5983
- Does not halt the GitHub import process when an error occurs. !5763
- Does not halt the GitHub import process when an error occurs. !5763
- User can edit closed MR with deleted fork (Katarzyna Kobierska Ula Budziszewska) !5496
v 8.11.2 (unreleased)
- Show "Create Merge Request" widget for push events to fork projects on the source project
v 8.11.1 (unreleased)
- Does not halt the GitHub import process when an error occurs
- Fix file links on project page when default view is Files !5933
- Fix file links on project page when default view is Files !5933
- Fixed enter key in search input not working !5888
- Fixed enter key in search input not working !5888
...
...
app/models/merge_request.rb
View file @
2d8d94a7
...
@@ -306,17 +306,17 @@ class MergeRequest < ActiveRecord::Base
...
@@ -306,17 +306,17 @@ class MergeRequest < ActiveRecord::Base
def
validate_fork
def
validate_fork
return
true
unless
target_project
&&
source_project
return
true
unless
target_project
&&
source_project
return
true
if
target_project
==
source_project
return
true
if
target_project
==
source_project
return
true
unless
fork_missing?
return
true
unless
fork
ed_source_project
_missing?
errors
.
add
:validate_fork
,
errors
.
add
:validate_fork
,
'Source project is not a fork of the target project'
'Source project is not a fork of the target project'
end
end
def
closed_without_fork?
def
closed_without_fork?
closed?
&&
fork_missing?
closed?
&&
fork
ed_source_project
_missing?
end
end
def
fork_missing?
def
fork
ed_source_project
_missing?
return
false
unless
for_fork?
return
false
unless
for_fork?
return
true
unless
source_project
return
true
unless
source_project
...
...
spec/models/merge_request_spec.rb
View file @
2d8d94a7
...
@@ -963,7 +963,7 @@ describe MergeRequest, models: true do
...
@@ -963,7 +963,7 @@ describe MergeRequest, models: true do
end
end
end
end
describe
"#fork_missing?"
do
describe
"#fork
ed_source_project
_missing?"
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:fork_project
)
{
create
(
:project
,
forked_from_project:
project
)
}
let
(
:fork_project
)
{
create
(
:project
,
forked_from_project:
project
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
...
@@ -976,13 +976,13 @@ describe MergeRequest, models: true do
...
@@ -976,13 +976,13 @@ describe MergeRequest, models: true do
target_project:
project
)
target_project:
project
)
end
end
it
{
expect
(
merge_request
.
fork_missing?
).
to
be_falsey
}
it
{
expect
(
merge_request
.
fork
ed_source_project
_missing?
).
to
be_falsey
}
end
end
context
"when the source project is the same as the target project"
do
context
"when the source project is the same as the target project"
do
let
(
:merge_request
)
{
create
(
:merge_request
,
source_project:
project
)
}
let
(
:merge_request
)
{
create
(
:merge_request
,
source_project:
project
)
}
it
{
expect
(
merge_request
.
fork_missing?
).
to
be_falsey
}
it
{
expect
(
merge_request
.
fork
ed_source_project
_missing?
).
to
be_falsey
}
end
end
context
"when the fork does not exist"
do
context
"when the fork does not exist"
do
...
@@ -996,7 +996,7 @@ describe MergeRequest, models: true do
...
@@ -996,7 +996,7 @@ describe MergeRequest, models: true do
unlink_project
.
execute
unlink_project
.
execute
merge_request
.
reload
merge_request
.
reload
expect
(
merge_request
.
fork_missing?
).
to
be_truthy
expect
(
merge_request
.
fork
ed_source_project
_missing?
).
to
be_truthy
end
end
end
end
end
end
...
...
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