refactor: use repositories instead of workspaces
This MR moves all extension logic to use repositories instead of workspaces (more details on #345 (closed)).
The main change in this MR is replacing two workspace helper method with repository helper methods:
before | after | explanation |
---|---|---|
getCurrentWorkspaceFolder |
gitExtensionWrapper.getActiveRepository |
it used to find workspace for the open file, return the only workspace, or return undefined if there was more workspaces. Now the logic is the same, but with repositories. |
getCurrentWorkspaceFolderOrSelectOne |
gitExtensionWrapper.getActiveRepositoryOrSelectOne |
same as the previous one, except that when there is no open file and multiple repositories, we show a quick pick dialogue and let the user choose which repository should be used. This is used, for example, if you want to open GitLab web with issues that are assigned to you. |
Screenshots
The open workspace doesn't have .git in it, but it does have multiple repositories in subfolders. The open text editor contains one file from a subfolder repository.
The screenshots highlight two changes (current_branch.ts
and status_bar.ts
) but there are more commands that are converted.
Before | After |
---|---|
How to review
This MR is structured in meaningful commits and is best-reviewed commit-by-commit. However, the diff discussion is only going to be visible when looking at the whole diff.
Future work
There is going to be a follow-up MR that renames workspaceFolder
to repositoryRoot
throughout the whole project.
Related to #345 (closed)