add ExpandRefs function
Created by: camdencheek
This PR adds a (currently unused) ExpandRefs function. This will be used for code monitors to expand commit/diff rev:
args that refer to git refs into static hashes so that we can search only new commits each time.
The flow will look like this:
- Users defines a code monitor like
type:diff repo:^myrepo$ rev:*refs/heads/* test
- When the search triggers, we expand
refs/heads/*
into stable hashes withgit rev-parse
- We save the expanded hashes for the repo being searched
- Next time a search is triggered, we expand again, but add the previous expansion as "exclude" commits (don't search any commits reachable by the commits we searched from last time).
This allows us to only search commits that we did not search the previous time this code monitor triggered.
Before this can be hooked up, we'll need to make code monitors repo-aware since we need to run searches per-repo.