Something went wrong while fetching comments. Please try again.
Created by: philipp-spiess
Closes #39158 (closed) Closes #39159 (closed)
This PR adds support for reading the GitHub style code owner specs from repositories to infer code ownership information automatically. To do that, we add a new dependency: https://github.com/hmarr/codeowners (MIT license so I don't see any legal issues).
Here's a bullet point recap of what changes we can find here:
codeownership.Ruleset
type that currently is a proxy to the codeowners.Ruleset
(from the new dependency). This allows us to expose a nice API but also will make it easier to later add other ways to get the code ownership mapping: E.g. we may want to fetch data rules from our postgres database instead..gitlab
path)map
so that we only have to create the codeowners.Ruleset
for a specific repo once per search. So if one repo returns 100 results, we only have one ruleset.autogold
while at it.I added a new test that mocks git server to return a specified code owners file. I've also tested it by running sg start
.
α sourcegraph (ps/code-ownership-query-codeowners-file-for-ownership-info)✗ go test github.com/sourcegraph/sourcegraph/internal/search/codeownership
ok github.com/sourcegraph/sourcegraph/internal/search/codeownership 1.448s