Skip to content

Search backend: expand glob refs as part of repo resolution ref validation

Administrator requested to merge cc/expand-revs into main

Created by: camdencheek

This adds an "expand ref globs" step to repo resolution. This is something that we always end up doing anyways, but it's spread across the codebase closer to gitserver accesses. In a quite a few places, we don't actually handle globs, we just punt or assume that there are no globs at that step, which is somtimes not true. This change encodes the expansion into the type system by making globs not representable in the RepositoryRevisions type.

This change is important because until we've expanded glob patterns, we don't know what revision we're working with because a glob usually expands to multiple revisions or no revisions. As an example of this, right now, repo:has.commit.after(date) does not work with globs because the presence of a ref glob means don't know what revision to actually do the check for. For the same reason, this is needed for the optimization of general repo:contains... optimizations. We need to know which refs we're filtering from in order to filter correctly.

This simplifies the RepositoryRevisions struct so that it no longer can contain globs. As part of this, I got to get rid of all the lazy glob expansion that is filling that struct and make it just a pure data type.

Again, sorry for the large change, but I was unable to figure out how to do this any more incrementally.

Test plan

All existing tests pass. Did some manual testing to feel better about it.

Merge request reports

Loading