Use ReposourceCloneURLToRepoName in editor endpoint
Created by: felixfbecker
This was done in our 3 people mob-programming session.
The /-/editor
endpoint currently just "guesses" the repo name, which is presumably the cause for https://github.com/sourcegraph/sourcegraph/issues/14423, because it for example doesn't take into account repositoryPathPatterns
. Various editor-side config settings were proposed to work around this, but the best fix would be for the backend to just properly resolve clone URLs using its knowledge of external services.
We actually have good logic for resolving git clone URLs to repo names instead of guessing the repo name in the GraphQL API, but it was not used in this endpoint.
This PR moves that logic into a shared package and makes the editor endpoint use it too.
Help needed:
- We had no clue in which folder to put this shared function and just put it somewhere. There is probably a better place?
- The
TestEditorRedirect
test fails with a null derefence panic now. I would guess this is because one of those global mocks are missing, but since everything compiles and I don't know what dependencies are required, I am lost how to fix this.
@sourcegraph/cloud can a helpful backend person help us out?