fix: workspace in project subfolder breaks Open active file on GitLab
This adds a new GitService.getGitRoot()
method, which is used in openers.js
’s getActiveFile
to generate correct file URLs when the workspace root is below the git root.
Background
We frequently have repositories with with e.g. /src/backend
and /src/web
. Web developers open /src/web
in VS Code, but after doing so the aforementioned “active file” commands generate incorrect URLs like this:
https://gitlab.notofilter.com/group/project/blob/develop/src/components/Component.tsx#L22
Whereas they should be generating URLs like this (prefixed with src/web/
):
https://gitlab.notofilter.com/group/project/blob/develop/src/web/src/components/Component.tsx#L22
Edited by Tomas Vik (OOO back on 2024-10-31)