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
beac214b
Commit
beac214b
authored
May 11, 2020
by
Kerri Miller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extract entry parsing by flagging
parent
9d7def72
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
10 deletions
+23
-10
ee/lib/gitlab/code_owners/file.rb
ee/lib/gitlab/code_owners/file.rb
+23
-10
No files found.
ee/lib/gitlab/code_owners/file.rb
View file @
beac214b
...
...
@@ -13,7 +13,7 @@ module Gitlab
end
def
parsed_data
@parsed_data
||=
sectional_codeowners?
?
get_parsed_sectional_data
:
get_parsed_data
@parsed_data
||=
get_parsed_data
end
def
empty?
...
...
@@ -21,10 +21,22 @@ module Gitlab
end
def
entry_for_path
(
path
)
return
sectional_entry_for_path
(
path
)
if
sectional_codeowners?
path
=
"/
#{
path
}
"
unless
path
.
start_with?
(
'/'
)
if
sectional_codeowners?
sectional_entry_for_path
(
path
)
else
non_sectional_entry_for_path
(
path
)
end
end
def
path
@blob
&
.
path
end
private
def
non_sectional_entry_for_path
(
path
)
matching_pattern
=
parsed_data
.
keys
.
reverse
.
detect
do
|
pattern
|
path_matches?
(
pattern
,
path
)
end
...
...
@@ -33,7 +45,6 @@ module Gitlab
end
def
sectional_entry_for_path
(
path
)
path
=
"/
#{
path
}
"
unless
path
.
start_with?
(
'/'
)
matches
=
[]
parsed_data
.
each
do
|
_
,
section_entries
|
...
...
@@ -47,12 +58,6 @@ module Gitlab
matches
end
def
path
@blob
&
.
path
end
private
def
data
if
@blob
&&
!
@blob
.
binary?
@blob
.
data
...
...
@@ -62,6 +67,14 @@ module Gitlab
end
def
get_parsed_data
if
sectional_codeowners?
get_parsed_sectional_data
else
get_parsed_non_sectional_data
end
end
def
get_parsed_non_sectional_data
parsed
=
{}
data
.
lines
.
each
do
|
line
|
...
...
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