hmarr / codeowners

🔒 Command line tool and Go library for CODEOWNERS files
MIT License
167 stars 19 forks source link

Does not show correct results for file path including leading ./ #17

Open jeffgran-dox opened 1 year ago

jeffgran-dox commented 1 year ago

Title says it all.

If you run codeowners ./src/file.go it will always hit a * rule, or just (unowned) if there is no * rule.

Whereas codeowners src/file.go will correctly match a rule that covers this file/directory.

jhaxon commented 6 months ago

I'm seeing this too. First rule in my CODEOWNERS is a * rule. Succeeding rules have more specific rules and override the first rule.

rwese commented 3 months ago

from the docs

Order is important; the last matching pattern takes the most precedence. When someone opens a pull request that only modifies JS files, only @js-owner and not the global owner(s) will be requested for a review.

I will take a stab at this

rwese commented 3 months ago

There is an issue with how * and /... paths are handled.

Fixing the * is easy, but I need to readup on the path handling for gitignores to not break the intended compatibility, since I assume there is a reason for the current solution.