Skip to content

Commit 5fae040

Browse files
author
Ziya Sarikaya
committed
fixes #63
1 parent 133c0a3 commit 5fae040

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"displayName": "Open in GitHub, Bitbucket, Gitlab, VisualStudio.com !",
44
"description": "Jump to a source code line in Github, Bitbucket, Gitlab, VisualStudio.com !",
55
"icon": "images/icon_200.png",
6-
"version": "1.3.3",
6+
"version": "1.3.4",
77
"publisher": "ziyasal",
88
"license": "SEE LICENSE IN LICENSE.md",
99
"galleryBanner": {
@@ -68,7 +68,6 @@
6868
},
6969
"openInGitHub.providerType": {
7070
"type": "string",
71-
"default": "gitlab",
7271
"enum": [
7372
"gitlab",
7473
"github",

src/extension.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ function getGitProviderLink(cb, fileFsPath, lines, pr) {
5555
}
5656

5757
try {
58-
provider = gitProvider(rawUri, sha);
58+
provider = gitProvider(rawUri, sha, branch);
5959
} catch (e) {
6060
let errmsg = e.toString();
6161
Window.showWarningMessage(`Unknown Git provider. ${errmsg}`);

src/gitProvider.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@ const path = require('path');
77
const useCommitSHAInURL = workspace.getConfiguration('openInGitHub').get('useCommitSHAInURL');
88

99
class BaseProvider {
10-
constructor(gitUrl, sha) {
10+
constructor(gitUrl, sha, branch) {
1111
this.gitUrl = gitUrl;
1212
this.sha = sha;
13+
this.branch = branch;
1314
}
1415

1516
get baseUrl() {
@@ -83,7 +84,7 @@ class VisualStudio extends BaseProvider {
8384

8485
webUrl(branch, filePath, line, endLine) {
8586
let query = {
86-
version: `GB${branch}`,
87+
version: `GB${this.branch}`,
8788
};
8889
if (filePath) {
8990
query['path'] = filePath;
@@ -100,7 +101,7 @@ class VisualStudio extends BaseProvider {
100101
}
101102

102103
const gitHubDomain = workspace.getConfiguration('openInGitHub').get('gitHubDomain', 'github.com');
103-
const providerType = workspace.getConfiguration('openInGitHub').get('providerType', 'unknown');
104+
const providerType = workspace.getConfiguration('openInGitHub').get('providerType', 'unknown') || 'unknown';
104105
const providerProtocol = workspace.getConfiguration('openInGitHub').get('providerProtocol', 'https');
105106
const defaultPrBranch = workspace.getConfiguration('openInGitHub').get('defaultPullRequestBranch', 'integration')
106107

@@ -117,13 +118,13 @@ const providers = {
117118
* @param {string} remoteUrl
118119
* @return {BaseProvider|null}
119120
*/
120-
function gitProvider(remoteUrl, sha) {
121+
function gitProvider(remoteUrl, sha, branch) {
121122
const gitUrl = gitUrlParse(remoteUrl);
122123
for (const domain of Object.keys(providers)) {
123124
if (domain === gitUrl.resource || domain === gitUrl.source) {
124-
return new providers[domain](gitUrl, sha);
125+
return new providers[domain](gitUrl, sha, branch);
125126
} else if (domain.indexOf(providerType) > -1) {
126-
return new providers[domain](gitUrl, sha);
127+
return new providers[domain](gitUrl, sha, branch);
127128
}
128129
}
129130
throw new Error('unknown Provider');

0 commit comments

Comments
 (0)