CODEOWNER display is inconsistent on file/dir view
Summary
Customer reported that Code owners display the codeowner at the top of the file in an inconsistent way.
- When an owner is assigned to a directory, using
/, code owner will not display, or the parent directory owner will be display. - When viewing a directory, only when viewing the files.
- When an owner is assigned to a directory without
/, code owner will only display when viewing the directory - When viewing the files, no codeowner will be display, or parent directory owner will be display.
In order to display both for the files and the directory a double entry needs to be added one for the directory with / and one without /
Steps to reproduce
- Create a CODEOWNER file in any project
- Add an entry such as
directory_1/ @user - Add an entry such as
directory_2 @otheruesr - When you view
directory_1no codeowner will be display, or the parent directory owner will be display - When view files in
directory_1, @user` will be display as codeowner - When you view
directory_2@otheruserwill be display as codeowner - When view files in
directory_2no codeowner will be display, or the parent directory owner will be display
Example Project
https://gitlab.com/gitlab-gold/ggutierrez/issues3/codeowner-component
What is the current bug behavior?
When an owner is assigned to a directory, using /, code owner will not display for the directory, or the parent directory owner will be display.
What is the expected correct behavior?
When an owner is assigned to a directory, using /, on the directory view the owner of that directory should be display, not empty or the parent directory owner.
Relevant logs and/or screenshots
For the codoeowner entry Only_file_entrie @ggdtest this is the view

For the codeowner entry Only_directory_entrie/ @ggdtest this is the view

Output of checks
Results of GitLab environment info
Expand for output related to GitLab environment info
(For installations with omnibus-gitlab package run and paste the output of: `sudo gitlab-rake gitlab:env:info`) (For installations from source run and paste the output of: `sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)
Results of GitLab application Check
Expand for output related to the GitLab application check
(For installations with omnibus-gitlab package run and paste the output of:
sudo gitlab-rake gitlab:check SANITIZE=true)(For installations from source run and paste the output of:
sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true)(we will only investigate if the tests are passing)
Possible fixes
Add two entries to CODEOWNER file, one with / and one without / to display the right owner at directory level and file level
Both_Codeowners_entries @ggdcc
Both_Codeowners_entries/ @ggdcc