From d64a1f881e57c8b3e3b8619437d88c77b3628698 Mon Sep 17 00:00:00 2001 From: Eric Amodio Date: Thu, 6 Dec 2018 14:49:05 -0500 Subject: [PATCH] Fixes #501 - azure devops support (ssh) --- src/git/remotes/azure-devops.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/git/remotes/azure-devops.ts b/src/git/remotes/azure-devops.ts index e3bba0d..df50d1f 100644 --- a/src/git/remotes/azure-devops.ts +++ b/src/git/remotes/azure-devops.ts @@ -2,11 +2,17 @@ import { Range } from 'vscode'; import { RemoteProvider } from './provider'; -const issueEnricherRegEx = /(^|\s)(#([0-9]+))\b/gi; +const issueEnricherRegex = /(^|\s)(#([0-9]+))\b/gi; const stripGitRegex = /\/_git\/?/i; +const sshDomainRegex = /^ssh\./i; +const sshPathRegex = /^\/?v\d\//i; + export class AzureDevOpsRemote extends RemoteProvider { constructor(domain: string, path: string, protocol?: string, name?: string) { + domain = domain.replace(sshDomainRegex, ''); + path = path.replace(sshPathRegex, ''); + super(domain, path, protocol, name); } @@ -22,7 +28,7 @@ export class AzureDevOpsRemote extends RemoteProvider { // Strip off any `_git` part from the repo url const baseUrl = this.baseUrl.replace(stripGitRegex, '/'); // Matches #123 - return message.replace(issueEnricherRegEx, `$1[$2](${baseUrl}/_workitems/edit/$3 "Open Work Item $2")`); + return message.replace(issueEnricherRegex, `$1[$2](${baseUrl}/_workitems/edit/$3 "Open Work Item $2")`); } protected getUrlForBranches(): string {