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
636637d3
Commit
636637d3
authored
Nov 22, 2016
by
Valery Sizov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix: MergeRequestSerializer breaks on when source_project doesn't exist anymore
parent
c07b2c04
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
3 deletions
+23
-3
app/models/merge_request.rb
app/models/merge_request.rb
+3
-0
changelogs/unreleased-ee/1289-merge-request-serializer-breaks.yml
...gs/unreleased-ee/1289-merge-request-serializer-breaks.yml
+5
-0
spec/models/merge_request_spec.rb
spec/models/merge_request_spec.rb
+15
-3
No files found.
app/models/merge_request.rb
View file @
636637d3
...
...
@@ -788,6 +788,9 @@ class MergeRequest < ActiveRecord::Base
end
def
rebase_in_progress?
# The source project can be deleted
return
false
unless
source_project
File
.
exist?
(
rebase_dir_path
)
&&
!
clean_stuck_rebase
end
...
...
changelogs/unreleased-ee/1289-merge-request-serializer-breaks.yml
0 → 100644
View file @
636637d3
---
title
:
'
Fix:
MergeRequestSerializer
breaks
on
MergeRequest#rebase_dir_path
when
source_project
doesn'
'
t
exist
anymore'
merge_request
:
author
:
spec/models/merge_request_spec.rb
View file @
636637d3
...
...
@@ -752,20 +752,32 @@ describe MergeRequest, models: true do
end
describe
'#rebase_in_progress?'
do
it
'return true'
do
it
'return
s
true'
do
allow
(
File
).
to
receive
(
:exist?
).
and_return
(
true
)
allow
(
File
).
to
receive
(
:new
).
and_return
(
double
(
:file
,
mtime:
Time
.
now
))
expect
(
subject
.
rebase_in_progress?
).
to
be_truthy
end
it
'return false'
do
it
'return
s
false'
do
allow
(
File
).
to
receive
(
:exist?
).
with
(
subject
.
rebase_dir_path
).
and_return
(
false
)
expect
(
subject
.
rebase_in_progress?
).
to
be_falsey
end
it
'return false if temporary file exists by is expired'
do
it
'return
s
false if temporary file exists by is expired'
do
allow
(
File
).
to
receive
(
:exist?
).
and_return
(
true
)
allow
(
File
).
to
receive
(
:new
).
and_return
(
double
(
:file
,
mtime:
Time
.
now
-
2
.
hours
))
expect
(
subject
.
rebase_in_progress?
).
to
be_falsey
end
it
'returns false if source_project is removed'
do
allow
(
subject
).
to
receive
(
:source_project
).
and_return
(
nil
)
allow
(
File
).
to
receive
(
:exist?
).
and_return
(
true
)
allow
(
File
).
to
receive
(
:new
).
and_return
(
double
(
:file
,
mtime:
Time
.
now
))
expect
(
File
).
not_to
have_received
(
:exist?
)
expect
(
subject
.
rebase_in_progress?
).
to
be_falsey
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