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
f0bbfe7a
Commit
f0bbfe7a
authored
Jul 29, 2016
by
Sean McGivern
Committed by
Fatih Acet
Aug 12, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add match line headers
parent
18398152
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
1 deletion
+8
-1
lib/gitlab/conflict/file.rb
lib/gitlab/conflict/file.rb
+8
-1
No files found.
lib/gitlab/conflict/file.rb
View file @
f0bbfe7a
...
@@ -75,11 +75,17 @@ module Gitlab
...
@@ -75,11 +75,17 @@ module Gitlab
return
@sections
if
@sections
return
@sections
if
@sections
chunked_lines
=
lines
.
chunk
{
|
line
|
line
.
type
.
nil?
}
chunked_lines
=
lines
.
chunk
{
|
line
|
line
.
type
.
nil?
}
last_candidate_match_header
=
nil
match_line_header
=
nil
match_line
=
nil
match_line
=
nil
@sections
=
chunked_lines
.
flat_map
.
with_index
do
|
(
no_conflict
,
lines
),
i
|
@sections
=
chunked_lines
.
flat_map
.
with_index
do
|
(
no_conflict
,
lines
),
i
|
section
=
nil
section
=
nil
lines
.
each
do
|
line
|
last_candidate_match_header
=
"
#{
line
.
text
}
"
if
line
.
text
.
match
(
/\A[A-Za-z$_]/
)
end
if
no_conflict
if
no_conflict
conflict_before
=
i
>
0
conflict_before
=
i
>
0
conflict_after
=
chunked_lines
.
peek
conflict_after
=
chunked_lines
.
peek
...
@@ -88,6 +94,7 @@ module Gitlab
...
@@ -88,6 +94,7 @@ module Gitlab
if
lines
.
length
>
CONTEXT_LINES
*
2
if
lines
.
length
>
CONTEXT_LINES
*
2
tail_lines
=
lines
.
last
(
CONTEXT_LINES
)
tail_lines
=
lines
.
last
(
CONTEXT_LINES
)
first_tail_line
=
tail_lines
.
first
first_tail_line
=
tail_lines
.
first
match_line_header
=
last_candidate_match_header
match_line
=
Gitlab
::
Diff
::
Line
.
new
(
''
,
match_line
=
Gitlab
::
Diff
::
Line
.
new
(
''
,
'match'
,
'match'
,
first_tail_line
.
index
,
first_tail_line
.
index
,
...
@@ -107,7 +114,7 @@ module Gitlab
...
@@ -107,7 +114,7 @@ module Gitlab
end
end
if
match_line
&&
!
section
if
match_line
&&
!
section
match_line
.
text
=
"@@ -
#{
match_line
.
old_pos
}
,
#{
lines
.
last
.
old_pos
}
+
#{
match_line
.
new_pos
}
,
#{
lines
.
last
.
new_pos
}
@@"
match_line
.
text
=
"@@ -
#{
match_line
.
old_pos
}
,
#{
lines
.
last
.
old_pos
}
+
#{
match_line
.
new_pos
}
,
#{
lines
.
last
.
new_pos
}
@@
#{
match_line_header
}
"
end
end
section
||=
{
conflict:
!
no_conflict
,
lines:
lines
}
section
||=
{
conflict:
!
no_conflict
,
lines:
lines
}
...
...
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