fix: Add support for absolute SSH remote URL parsing

Description

This MR adds support for parsing SSH remote URLs that use absolute paths (starting with :/).

Changes:

  • Added sshRemoteWithAbsolutePath regex pattern in normalizeSshRemote() function to detect and normalize absolute SSH paths
  • Added the new pattern check before the general sshRemoteWithPath pattern to ensure correct parsing order
  • Added unit tests covering absolute SSH path scenarios

Technical Details:

The issue occurred because SSH URLs like git@gitlab.com:/project/path.git were not being recognized. The colon-slash (:/) pattern indicates an absolute path on the remote server. The fix normalizes these URLs to the standard ssh:// format so they can be parsed correctly.

Resolves #2164 (closed)

How has this been tested?

Unit Tests:

  • Added two new test cases in git_remote_parser.test.ts:
    • Basic absolute SSH path: git@gitlab.com:/gitlab-org/gitlab-vscode-extension.git
    • Nested groups with absolute path: git@gitlab.com:/group/subgroup/project.git
  • All existing tests continue to pass
  • Verified the new pattern is checked in the correct order (before sshRemoteWithPath)

Manual Testing:

To test manually:

  1. Set up a repository with an absolute SSH path remote: git remote add origin git@gitlab.com:/group/project.git
  2. Open the repository in VS Code with the extension
  3. Verify the extension correctly identifies and links to the GitLab project

Testing Environment:

  • Modified files are in src/desktop/git/ (desktop-only changes)
  • No changes to src/browser or src/common, so WebIDE interoperability is not affected
  • Integration tests not required as this is a focused fix to an existing parsing function with comprehensive unit test coverage

Screenshots (if appropriate)

N/A - This is a parsing logic fix with no UI changes

What CHANGELOG entry will this MR create?

  • [x] fix: Bug fix - fixes a user-facing issue in production - included in changelog
  • [ ] feature: New feature - a user-facing change which adds functionality - included in changelog
  • [ ] BREAKING CHANGE: (fix or feature that would cause existing functionality to change)
  • [ ] None - other non-user-facing changes

Changelog entry:

fix: Add support for absolute SSH remote URL parsing

Label: VS Code Editor Extensions

Merge request reports

Loading