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
3ecc2b04
Commit
3ecc2b04
authored
Jul 17, 2018
by
Oswaldo Ferreira
Committed by
Sean McGivern
Jul 18, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Render MR page when no persisted diff_refs or diffs size
parent
2f16eab0
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
1 deletion
+31
-1
app/models/merge_request_diff.rb
app/models/merge_request_diff.rb
+1
-1
changelogs/unreleased/osw-fallback-to-collection-when-no-diff-refs.yml
...released/osw-fallback-to-collection-when-no-diff-refs.yml
+5
-0
spec/controllers/projects/merge_requests_controller_spec.rb
spec/controllers/projects/merge_requests_controller_spec.rb
+17
-0
spec/models/merge_request_diff_spec.rb
spec/models/merge_request_diff_spec.rb
+8
-0
No files found.
app/models/merge_request_diff.rb
View file @
3ecc2b04
...
@@ -182,7 +182,7 @@ class MergeRequestDiff < ActiveRecord::Base
...
@@ -182,7 +182,7 @@ class MergeRequestDiff < ActiveRecord::Base
end
end
def
diffs
(
diff_options
=
nil
)
def
diffs
(
diff_options
=
nil
)
if
without_files?
&&
comparison
=
diff_refs
.
compare_in
(
project
)
if
without_files?
&&
comparison
=
diff_refs
&
.
compare_in
(
project
)
# It should fetch the repository when diffs are cleaned by the system.
# It should fetch the repository when diffs are cleaned by the system.
# We don't keep these for storage overload purposes.
# We don't keep these for storage overload purposes.
# See https://gitlab.com/gitlab-org/gitlab-ce/issues/37639
# See https://gitlab.com/gitlab-org/gitlab-ce/issues/37639
...
...
changelogs/unreleased/osw-fallback-to-collection-when-no-diff-refs.yml
0 → 100644
View file @
3ecc2b04
---
title
:
Render MR page when diffs cannot be fetched from the database or the git repository
merge_request
:
20680
author
:
type
:
fixed
spec/controllers/projects/merge_requests_controller_spec.rb
View file @
3ecc2b04
...
@@ -53,6 +53,23 @@ describe Projects::MergeRequestsController do
...
@@ -53,6 +53,23 @@ describe Projects::MergeRequestsController do
it_behaves_like
"loads labels"
,
:show
it_behaves_like
"loads labels"
,
:show
describe
'as html'
do
describe
'as html'
do
context
'when diff files were cleaned'
do
render_views
it
'renders page when diff size is not persisted and diff_refs does not exist'
do
diff
=
merge_request
.
merge_request_diff
diff
.
clean!
diff
.
update!
(
real_size:
nil
,
start_commit_sha:
nil
,
base_commit_sha:
nil
)
go
(
format: :html
)
expect
(
response
).
to
be_success
end
end
it
"renders merge request page"
do
it
"renders merge request page"
do
go
(
format: :html
)
go
(
format: :html
)
...
...
spec/models/merge_request_diff_spec.rb
View file @
3ecc2b04
...
@@ -82,6 +82,14 @@ describe MergeRequestDiff do
...
@@ -82,6 +82,14 @@ describe MergeRequestDiff do
diff
.
diffs
diff
.
diffs
end
end
it
'returns persisted diffs if diff refs does not exist'
do
expect
(
diff
).
to
receive
(
:load_diffs
)
diff
.
update!
(
start_commit_sha:
nil
,
base_commit_sha:
nil
)
diff
.
diffs
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