Skip to content

compute: don't hydrate file contents for "type:path"

Warren Gifford requested to merge rvt/compute-type into main

Created by: rvantonder

Stacked on https://github.com/sourcegraph/sourcegraph/pull/34677

I want compute queries to efficiently return just a file path result (previously, you couldn't avoid fetching file contents because we always fetched file contents for a given FileMatch). This PR allows to avoid hydrating content when type:path is set. Our lack of a dedicated type really leaks into things here and makes my compute code ugly 😢 🤮 . But I dislike the inefficiency more than how this uglifies things. Having this will let us compute language statistics quickly.

The state tracking could be entirely avoided by having a dedicated PathMatch.

Test plan

Added tests.

Merge request reports

Loading