This repository was archived by the owner on Sep 30, 2024. It is now read-only.
repo exclusion: switch to dynamic rule builder#58405
Merged
Conversation
e5e224d to
4316606
Compare
eseliger
approved these changes
Nov 20, 2023
internal/repos/exclude.go
Outdated
Comment on lines
153
to
179
Member
There was a problem hiding this comment.
wonder if it would be nice to encapsulate the excluder in a separate package, and then implement this special excludeFn in the github source file, I stumbled a bit over the fact that there's a github specific implementation in this otherwise quite generic file. Not needed for this PR.
Contributor
Author
There was a problem hiding this comment.
Yeah. I keep thinking about this. I haven't solved the puzzle yet. I have an idea for all the "rules" to compile down to this, but I still need to play around with the ideas a bit.
4316606 to
e1754f8
Compare
e1754f8 to
1f90a29
Compare
Contributor
|
Codenotify: Notifying subscribers in CODENOTIFY files for diff 000a43e...1f90a29.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a follow-up to https://github.com/sourcegraph/sourcegraph/pull/58377 and changes how
excludeworks by AND'ing all conditions in a single rule together.It does this mostly by refactoring the code and turning things upside down (inside out?):
[]excludeentry in a code host connection config being turned into a separate condition, one of which had to be true*rulethat can have multiple conditions and all of them have to be true for a repo to be excluded.Best explained with an example.
Old code:
New code:
Comparison not totally fair because stil need to add error handling for invalid patterns.
Downsides
Currently it's a lot more function calls per exclusion-check... we could probably amortize the cost but I'm not sure yet what the nicest way is.
Test plan