Loading src/desktop/git/git_remote_parser.test.ts +11 −0 Original line number Diff line number Diff line Loading @@ -100,6 +100,17 @@ describe('git_remote_parser', () => { 'ssh://git@example.com:2222/fatihacet/gitlab-vscode-extension.git', ['example.com', 'example.com', 'ssh:', 'fatihacet', 'gitlab-vscode-extension'], ], [ // For more details see: https://gitlab.com/gitlab-org/gitlab-vscode-extension/-/issues/2164 // Absolute SSH path with :/ separator 'git@gitlab.com:/gitlab-org/gitlab-vscode-extension.git', ['gitlab.com', 'gitlab.com', 'ssh:', 'gitlab-org', 'gitlab-vscode-extension'], ], [ // Another absolute SSH path example 'git@gitlab.com:/group/subgroup/project.git', ['gitlab.com', 'gitlab.com', 'ssh:', 'group/subgroup', 'project'], ], ])('should parse %s', (remote, parsed) => { const [host, hostname, protocol, namespace, projectPath] = parsed; expect(parseGitLabRemote(remote, 'https://gitlab.com')).toEqual({ Loading src/desktop/git/git_remote_parser.ts +9 −0 Original line number Diff line number Diff line Loading @@ -65,6 +65,15 @@ function normalizeSshRemote(remote: string): string { return `ssh://${sshRemoteWithSchemeAndCustomPort[1]}${sshRemoteWithSchemeAndCustomPort[2]}`; } // Regex to match git SSH remotes with absolute paths (starting with :/) // Example: git@gitlab.com:/gitlab-org/gitlab-vscode-extension.git // For more information see: // https://gitlab.com/gitlab-org/gitlab-vscode-extension/-/issues/2164 const sshRemoteWithAbsolutePath = remote.match(`([a-zA-Z0-9_-]+@.*?):/(.*)`); if (sshRemoteWithAbsolutePath) { return `ssh://${sshRemoteWithAbsolutePath[1]}/${sshRemoteWithAbsolutePath[2]}`; } // Regex to match git SSH remotes without URL scheme and no custom port // Example: git@example.com:2222/fatihacet/gitlab-vscode-extension.git // For more information see this comment: Loading Loading
src/desktop/git/git_remote_parser.test.ts +11 −0 Original line number Diff line number Diff line Loading @@ -100,6 +100,17 @@ describe('git_remote_parser', () => { 'ssh://git@example.com:2222/fatihacet/gitlab-vscode-extension.git', ['example.com', 'example.com', 'ssh:', 'fatihacet', 'gitlab-vscode-extension'], ], [ // For more details see: https://gitlab.com/gitlab-org/gitlab-vscode-extension/-/issues/2164 // Absolute SSH path with :/ separator 'git@gitlab.com:/gitlab-org/gitlab-vscode-extension.git', ['gitlab.com', 'gitlab.com', 'ssh:', 'gitlab-org', 'gitlab-vscode-extension'], ], [ // Another absolute SSH path example 'git@gitlab.com:/group/subgroup/project.git', ['gitlab.com', 'gitlab.com', 'ssh:', 'group/subgroup', 'project'], ], ])('should parse %s', (remote, parsed) => { const [host, hostname, protocol, namespace, projectPath] = parsed; expect(parseGitLabRemote(remote, 'https://gitlab.com')).toEqual({ Loading
src/desktop/git/git_remote_parser.ts +9 −0 Original line number Diff line number Diff line Loading @@ -65,6 +65,15 @@ function normalizeSshRemote(remote: string): string { return `ssh://${sshRemoteWithSchemeAndCustomPort[1]}${sshRemoteWithSchemeAndCustomPort[2]}`; } // Regex to match git SSH remotes with absolute paths (starting with :/) // Example: git@gitlab.com:/gitlab-org/gitlab-vscode-extension.git // For more information see: // https://gitlab.com/gitlab-org/gitlab-vscode-extension/-/issues/2164 const sshRemoteWithAbsolutePath = remote.match(`([a-zA-Z0-9_-]+@.*?):/(.*)`); if (sshRemoteWithAbsolutePath) { return `ssh://${sshRemoteWithAbsolutePath[1]}/${sshRemoteWithAbsolutePath[2]}`; } // Regex to match git SSH remotes without URL scheme and no custom port // Example: git@example.com:2222/fatihacet/gitlab-vscode-extension.git // For more information see this comment: Loading