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
41d0cc7b
Commit
41d0cc7b
authored
Dec 11, 2020
by
Thomas Randolph
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Skip adding the diff file ID if there's no content_sha
parent
15feba24
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
1 deletion
+17
-1
app/assets/javascripts/diffs/utils/diff_file.js
app/assets/javascripts/diffs/utils/diff_file.js
+4
-1
spec/frontend/diffs/utils/diff_file_spec.js
spec/frontend/diffs/utils/diff_file_spec.js
+13
-0
No files found.
app/assets/javascripts/diffs/utils/diff_file.js
View file @
41d0cc7b
...
...
@@ -48,7 +48,10 @@ export function prepareRawDiffFile({ file, allFiles, meta = false }) {
},
};
if
(
!
meta
)
{
// It's possible, but not confirmed, that `content_sha` isn't available sometimes
// See: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/49506#note_464692057
// We don't want duplicate IDs if that's the case, so we just don't assign an ID
if
(
!
meta
&&
file
.
content_sha
)
{
additionalProperties
.
id
=
identifier
(
file
);
}
...
...
spec/frontend/diffs/utils/diff_file_spec.js
View file @
41d0cc7b
...
...
@@ -99,5 +99,18 @@ describe('diff_file utilities', () => {
expect
(
preppedFile
).
not
.
toHaveProp
(
'
id
'
);
});
it
(
'
does not set the id property if the file is missing a `content_sha`
'
,
()
=>
{
const
fileMissingContentSha
=
{
...
files
[
0
]
};
delete
fileMissingContentSha
.
content_sha
;
const
preppedFile
=
prepareRawDiffFile
({
file
:
fileMissingContentSha
,
allFiles
:
files
,
});
expect
(
preppedFile
).
not
.
toHaveProp
(
'
id
'
);
});
});
});
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