Skip to content

search: handle negated revisions during rev validation

Warren Gifford requested to merge sh/fix-regression into main

Created by: stefanhengl

Fixes a regression introduced in #13271

Before #13271 ^revision caused a BadCommitError because ^revision (with caret) could not be resolved to a commit. Because we did not handle BadCommitError, ^revision was added to the list of resolved revisions anyway, which is required downstream for searches of type diff and commit.

With #13271 ^revision causes a BadCommitError and a warning is returned to the user. ^revision is not added to the slice of resolved revisions.

After this PR we strip the prefix ^ and validate the revision. If the revision is valid, it is added to the resolved repositories. Otherwise, a warning is returned.

Positive side effect:

  • revisions with prefix ^ are now actually validated and reported missing just like other revisions
  • I covered the logic with tests so introducing further regressions should be harder

Merge request reports

Loading