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
3764fd4b
Commit
3764fd4b
authored
Oct 13, 2016
by
Sean McGivern
Committed by
Alfredo Sumaran
Oct 13, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add blob_ace_mode to conflict content response
parent
cdd0dd50
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
0 deletions
+17
-0
lib/gitlab/conflict/file.rb
lib/gitlab/conflict/file.rb
+5
-0
spec/controllers/projects/merge_requests_controller_spec.rb
spec/controllers/projects/merge_requests_controller_spec.rb
+1
-0
spec/lib/gitlab/conflict/file_spec.rb
spec/lib/gitlab/conflict/file_spec.rb
+11
-0
No files found.
lib/gitlab/conflict/file.rb
View file @
3764fd4b
...
@@ -25,6 +25,10 @@ module Gitlab
...
@@ -25,6 +25,10 @@ module Gitlab
merge_file_result
[
:data
]
merge_file_result
[
:data
]
end
end
def
our_blob
@our_blob
||=
repository
.
blob_at
(
merge_request
.
diff_refs
.
head_sha
,
our_path
)
end
def
type
def
type
lines
unless
@type
lines
unless
@type
...
@@ -209,6 +213,7 @@ module Gitlab
...
@@ -209,6 +213,7 @@ module Gitlab
json_hash
.
tap
do
|
json_hash
|
json_hash
.
tap
do
|
json_hash
|
if
opts
[
:full_content
]
if
opts
[
:full_content
]
json_hash
[
:content
]
=
content
json_hash
[
:content
]
=
content
json_hash
[
:blob_ace_mode
]
=
our_blob
&&
our_blob
.
language
.
try
(
:ace_mode
)
else
else
json_hash
[
:sections
]
=
sections
if
type
.
text?
json_hash
[
:sections
]
=
sections
if
type
.
text?
json_hash
[
:type
]
=
type
json_hash
[
:type
]
=
type
...
...
spec/controllers/projects/merge_requests_controller_spec.rb
View file @
3764fd4b
...
@@ -712,6 +712,7 @@ describe Projects::MergeRequestsController do
...
@@ -712,6 +712,7 @@ describe Projects::MergeRequestsController do
'new_path'
=>
path
,
'new_path'
=>
path
,
'blob_icon'
=>
'file-text-o'
,
'blob_icon'
=>
'file-text-o'
,
'blob_path'
=>
a_string_ending_with
(
path
),
'blob_path'
=>
a_string_ending_with
(
path
),
'blob_ace_mode'
=>
'ruby'
,
'content'
=>
content
)
'content'
=>
content
)
end
end
end
end
...
...
spec/lib/gitlab/conflict/file_spec.rb
View file @
3764fd4b
...
@@ -257,5 +257,16 @@ FILE
...
@@ -257,5 +257,16 @@ FILE
it
'includes the blob icon for the file'
do
it
'includes the blob icon for the file'
do
expect
(
conflict_file
.
as_json
[
:blob_icon
]).
to
eq
(
'file-text-o'
)
expect
(
conflict_file
.
as_json
[
:blob_icon
]).
to
eq
(
'file-text-o'
)
end
end
context
'with the full_content option passed'
do
it
'includes the full content of the conflict'
do
expect
(
conflict_file
.
as_json
(
full_content:
true
)).
to
have_key
(
:content
)
end
it
'includes the detected language of the conflict file'
do
expect
(
conflict_file
.
as_json
(
full_content:
true
)[
:blob_ace_mode
]).
to
eq
(
'ruby'
)
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