Skip to content

dev/ci: rewrite ChangedFiles as bitmask Diff

Warren Gifford requested to merge ci/bitmask-diff into main

Created by: bobheadxi

Rewrites ChangedFiles with a new bitmask-based implementation, Diff, that enables more flexibility over programatically iterating over our various Diff options. See this in action in https://github.com/sourcegraph/sourcegraph/pull/30532, which is the end state of this stack of changes. Demonstrative example:

https://github.com/sourcegraph/sourcegraph/blob/5156163692ec32a75729f9554a22b184959e902c/enterprise/dev/ci/internal/ci/changed/diff.go#L112-L119

Conditioning on Diffs now looks like this:

if diff.Has(changed.Client | changed.GraphQL) {

Semantically, this reads: "diff has changed GraphQL or changed Client". Perhaps a little awkward, so I'm open to suggestions about the semantics here.

Also introduces testing that iterates over Diff types and ensures each has relevant properties defined, as well as tests covering some of the new and old functionality.

Merge request reports

Loading