Skip to content

lazily compute commit oid if it is not known (because of zoekt)

Administrator requested to merge index-file-contents into master

Created by: ijsnow

Zoekt passes an empty string to denote that matches came from the default branch. This is because computing the commit of the default branch can be expensive and is rarely needed. However, this results in a panic when trying to script the graphql api to get file contents returned from indexed search results.

This PR changes references to gitCommitResolver.oid to use the function call so that it can be lazily computed if we don't have the exact commit. The commit is taken from zoekt's index information rather than the default git branch because we don't want to assume that zoekt is always up to date at the time of the search.

Fixes https://github.com/sourcegraph/sourcegraph/issues/2221.

Merge request reports

Loading