Skip to content

add ExpandRefs function

Administrator requested to merge cc/expand-refs into main

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:

  1. Users defines a code monitor like type:diff repo:^myrepo$ rev:*refs/heads/* test
  2. When the search triggers, we expand refs/heads/* into stable hashes with git rev-parse
  3. We save the expanded hashes for the repo being searched
  4. 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.

Merge request reports

Loading