"Revision not found" error when repository has no default branch even if the given revision exists
Created by: lguychard
Reported by https://app.hubspot.com/contacts/2762526/company/2931649618
Phabricator users may configure staging areas for their repositories.
If the staging repository is synced to the Sourcegraph instance, we will use it for code intelligence (eg. basic code intel search requests) and the Go to definition, Find references buttons in the hover tooltip will link to it:
Phabricator uses staging areas by creating two tags for each diff, representing the base & head commits of the diff. It is not necessary for the staging repository to have a default branch, and as such it will show up as an empty repository on the Sourcegraph instance:
This is not necessarily an issue in itself, as long as links to specific revisions work (although it makes it impossible to browse the staging tags in the UI). However, in spite of the revisions being synced to Sourcegraph, they are not accessible in the UI:
This is because resolveRev()
throws a RevNotFoundError('HEAD')
if the repository has no default branch, when trying to resolve any revision.