Skip to content

feat: detect instanceUrl from git remotes and PATs

Part of #34 (closed)

find the intersection of git remotes hostnames and PATs hostnames, and if the intersection has exactly one hostname, use that as the instanceUrl otherwise, just do nothing.

Testing strategy

  1. The configured instanceUrl takes precedence
    1. configure "gitlab.instanceUrl" in the workspace settings and make sure that GitLab Workflow always uses this instanceUrl
  2. We use the heuristic (no instanceUrl config)
    1. We have 2 tokens configured
      • https://gitlab.com
      • https://dev.gitlab.org (this can be any other instance)
    2. Have a project with only one remote
      git remote -v
      dev	git@dev.gitlab.org:gitlab/gitter/webapp.git (fetch)
      dev	git@dev.gitlab.org:gitlab/gitter/webapp.git (push)
      1. Run GitLab: Show issues assigned to me command
      2. The extension opens the dev.gitlab.org web
    3. Have a project with both remotes (heuristic matches 2 intersections)
      git remote -v
      dev	git@dev.gitlab.org:gitlab/gitter/webapp.git (fetch)
      dev	git@dev.gitlab.org:gitlab/gitter/webapp.git (push)
      origin	git@example.com:gitlab-org/gitter/webapp.git (fetch)
      origin	git@example.com:gitlab-org/gitter/webapp.git (push)
      1. Run GitLab: Show issues assigned to me command
      2. Extension tries to open the gitlab.com web (default)
Edited by Tomas Vik

Merge request reports