☂ ️Handling repositoryPathPatterns in the browser extension and extension API
Created by: felixfbecker
Currently, the browser extension and extensions make assumptions that repo names start with the code host hostname.
This is a wrong assumption for private instances, where the repo name is arbitrary.
When we have a Sourcegraph instance defined, we need to consult it for the right repo name for a repo.
One possible approach for this is to get the clone URL and use the GraphQL API to resolve this to a repo (this may be difficult if we cannot easily get or infer the clone URL on every page, and could cost more).
Another is to fetch the repositoryPathPatterns
and run the mapping on the client side (which may be dangerous if the logic is complex and we'd have to duplicate lots of logic).
If we are on a private repo that's not on the instance (e.g. sourcegraph.com), we need to do the codehost-name prefixed behavior.
For extensions, we need to expose ways to get info about the repo source so extensions can know where it came from (e.g. what code host).
An idea for this is exposing info from the GraphQL externalRepository
field on the WorkspaceRoot
interface (which currently only has uri
).
Fixes #4368 (closed) Fixes #4278 Fixes #4414 (closed) Rel #2471