Skip to content

Commit dafa74d

Browse files
committed
Fixes #372 - VSTS workitems links don't work
1 parent 72e65f3 commit dafa74d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/git/remotes/visualStudio.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { Range } from 'vscode';
33
import { RemoteProvider } from './provider';
44

55
const issueEnricherRegEx = /(^|\s)(#([0-9]+))\b/gi;
6+
const stripGitRegex = /\/_git\/?/i;
67

78
export class VisualStudioService extends RemoteProvider {
89

@@ -20,8 +21,10 @@ export class VisualStudioService extends RemoteProvider {
2021
}
2122

2223
enrichMessage(message: string): string {
24+
// Strip off any `_git` part from the repo url
25+
const baseUrl = this.baseUrl.replace(stripGitRegex, '/');
2326
// Matches #123
24-
return message.replace(issueEnricherRegEx, `$1[$2](${this.baseUrl}/_workitems/edit/$3 "Open Work Item $2")`);
27+
return message.replace(issueEnricherRegEx, `$1[$2](${baseUrl}/_workitems/edit/$3 "Open Work Item $2")`);
2528
}
2629

2730
protected getUrlForBranches(): string {

0 commit comments

Comments
 (0)