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
Tatuya Kamada
gitlab-ce
Commits
52eb523c
Commit
52eb523c
authored
Aug 03, 2016
by
Sean McGivern
Committed by
Fatih Acet
Aug 12, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add blob_icon to conflict file JSON
parent
e50e88b8
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
2 deletions
+8
-2
lib/gitlab/conflict/file.rb
lib/gitlab/conflict/file.rb
+4
-2
spec/lib/gitlab/conflict/file_spec.rb
spec/lib/gitlab/conflict/file_spec.rb
+4
-0
No files found.
lib/gitlab/conflict/file.rb
View file @
52eb523c
...
...
@@ -2,18 +2,20 @@ module Gitlab
module
Conflict
class
File
include
Gitlab
::
Routing
.
url_helpers
include
IconsHelper
class
MissingResolution
<
StandardError
end
CONTEXT_LINES
=
3
attr_reader
:merge_file_result
,
:their_path
,
:our_path
,
:merge_request
,
:repository
attr_reader
:merge_file_result
,
:their_path
,
:our_path
,
:
our_mode
,
:
merge_request
,
:repository
def
initialize
(
merge_file_result
,
conflict
,
merge_request
:)
@merge_file_result
=
merge_file_result
@their_path
=
conflict
[
:theirs
][
:path
]
@our_path
=
conflict
[
:ours
][
:path
]
@our_mode
=
conflict
[
:ours
][
:mode
]
@merge_request
=
merge_request
@repository
=
merge_request
.
project
.
repository
end
...
...
@@ -30,7 +32,6 @@ module Gitlab
new_file
=
resolve_lines
(
resolution
).
map
(
&
:text
).
join
(
"
\n
"
)
oid
=
rugged
.
write
(
new_file
,
:blob
)
our_mode
=
index
.
conflict_get
(
our_path
)[
:ours
][
:mode
]
index
.
add
(
path:
our_path
,
oid:
oid
,
mode:
our_mode
)
index
.
conflict_remove
(
our_path
)
end
...
...
@@ -150,6 +151,7 @@ module Gitlab
{
old_path:
their_path
,
new_path:
our_path
,
blob_icon:
file_type_icon_class
(
'file'
,
our_mode
,
our_path
),
blob_path:
namespace_project_blob_path
(
merge_request
.
project
.
namespace
,
merge_request
.
project
,
::
File
.
join
(
merge_request
.
diff_refs
.
head_sha
,
our_path
)),
...
...
spec/lib/gitlab/conflict/file_spec.rb
View file @
52eb523c
...
...
@@ -148,5 +148,9 @@ describe Gitlab::Conflict::File, lib: true do
expect
(
conflict_file
.
as_json
[
:blob_path
]).
to
eq
(
"/
#{
project
.
namespace
.
to_param
}
/
#{
merge_request
.
project
.
to_param
}
/blob/
#{
our_commit
.
oid
}
/files/ruby/regex.rb"
)
end
it
'includes the blob icon for the file'
do
expect
(
conflict_file
.
as_json
[
:blob_icon
]).
to
eq
(
'file-text-o'
)
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