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
47ea7093
Commit
47ea7093
authored
Jan 25, 2021
by
Igor Drozdov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix viewing blobs for broken MRs
Render code-nav definition path even if head sha does not exist
parent
916d3844
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
5 deletions
+21
-5
app/helpers/diff_helper.rb
app/helpers/diff_helper.rb
+1
-1
app/serializers/diffs_entity.rb
app/serializers/diffs_entity.rb
+3
-1
changelogs/unreleased/id-fix-no-route-error.yml
changelogs/unreleased/id-fix-no-route-error.yml
+5
-0
spec/serializers/diffs_entity_spec.rb
spec/serializers/diffs_entity_spec.rb
+12
-3
No files found.
app/helpers/diff_helper.rb
View file @
47ea7093
...
...
@@ -254,7 +254,7 @@ module DiffHelper
end
def
code_navigation_path
(
diffs
)
Gitlab
::
CodeNavigationPath
.
new
(
merge_request
.
project
,
diffs
.
diff_refs
&
.
head_sha
)
Gitlab
::
CodeNavigationPath
.
new
(
merge_request
.
project
,
merge_request
.
diff_
head_sha
)
end
def
conflicts
...
...
app/serializers/diffs_entity.rb
View file @
47ea7093
...
...
@@ -79,7 +79,9 @@ class DiffsEntity < Grape::Entity
end
expose
:definition_path_prefix
do
|
diffs
|
project_blob_path
(
merge_request
.
project
,
diffs
.
diff_refs
&
.
head_sha
)
next
unless
merge_request
.
diff_head_sha
project_blob_path
(
merge_request
.
project
,
merge_request
.
diff_head_sha
)
end
def
merge_request
...
...
changelogs/unreleased/id-fix-no-route-error.yml
0 → 100644
View file @
47ea7093
---
title
:
Fix viewing blobs for broken MRs
merge_request
:
52483
author
:
type
:
fixed
spec/serializers/diffs_entity_spec.rb
View file @
47ea7093
...
...
@@ -3,10 +3,11 @@
require
'spec_helper'
RSpec
.
describe
DiffsEntity
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let_it_be
(
:user
)
{
create
(
:user
)
}
let_it_be
(
:project
)
{
create
(
:project
,
:repository
)
}
let_it_be
(
:merge_request
)
{
create
(
:merge_request_with_diffs
,
target_project:
project
,
source_project:
project
)
}
let
(
:request
)
{
EntityRequest
.
new
(
project:
project
,
current_user:
user
)
}
let
(
:merge_request
)
{
create
(
:merge_request_with_diffs
,
target_project:
project
,
source_project:
project
)
}
let
(
:merge_request_diffs
)
{
merge_request
.
merge_request_diffs
}
let
(
:options
)
do
{
request:
request
,
merge_request:
merge_request
,
merge_request_diffs:
merge_request_diffs
}
...
...
@@ -30,6 +31,14 @@ RSpec.describe DiffsEntity do
)
end
context
'broken merge request'
do
let
(
:merge_request
)
{
create
(
:merge_request
,
:invalid
,
target_project:
project
,
source_project:
project
)
}
it
'renders without errors'
do
expect
{
subject
}.
not_to
raise_error
end
end
context
"when a commit_id is passed"
do
let
(
:commits
)
{
merge_request
.
commits
}
let
(
:entity
)
do
...
...
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