Code owner cannot push to files in unprotected branch

Summary

Users cannot push commit of files to unprotected branches when there's CODEOWNER for the file.

Steps to reproduce

  1. Create a repository with CODEOWNER applied
  2. Create an unprotected branch
  3. Make sure you're the CODEOWNER of the file you're trying to edit on the unprotected branch
  4. Edit and commit the file directly on the branch
  5. Observe the error message Pushes to protected branches that contain changes to files that match patterns defined in .gitlab/CODEOWNERSare disabled for this project. Please submit these changes via a merge request. The following pattern(s) from.gitlab/CODEOWNERS were matched: - <filename>

Example Project

(If possible, please create an example project here on GitLab.com that exhibits the problematic behavior, and link to it here in the bug report)

(If you are using an older version of GitLab, this will also determine whether the bug is fixed in a more recent version)

What is the current bug behavior?

Pushing directly to file in CODEOWNER is impossible. All commits need to be merged via a merge request.

What is the expected correct behavior?

Users should be able to push to an unprotected branch

Relevant logs and/or screenshots

(Paste any relevant logs - please use code blocks (```) to format console output, logs, and code as it's tough to read otherwise.)

Output of checks

This bug happens on GitLab.com; GitLab Enterprise Edition 13.1.0-pre 1e2eda54

Workaround

Commit through Web IDE

Edited by Sokunrotanak Srey (Rotanak)