@@ -7,9 +7,10 @@ const path = require('path');
77const useCommitSHAInURL = workspace . getConfiguration ( 'openInGitHub' ) . get ( 'useCommitSHAInURL' ) ;
88
99class 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
102103const 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' ;
104105const providerProtocol = workspace . getConfiguration ( 'openInGitHub' ) . get ( 'providerProtocol' , 'https' ) ;
105106const 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