@@ -28,13 +28,13 @@ function getGitProviderLink(cb, fileFsPath, lines, pr) {
2828 . then ( readConfigFile )
2929 . then ( config => {
3030
31- gitRev . branch ( repoDir , function ( branchErr , branch ) {
31+ gitRev . long ( repoDir , function ( branchErr , sha ) {
3232 var rawUri ,
3333 configuredBranch ,
3434 provider = null ,
3535 remoteName ;
3636
37- if ( branchErr || ! branch ) branch = 'master' ;
37+ var branch = 'master' ;
3838
3939 // Check to see if the branch has a configured remote
4040 configuredBranch = config [ `branch "${ branch } "` ] ;
@@ -78,12 +78,12 @@ function getGitProviderLink(cb, fileFsPath, lines, pr) {
7878 } else {
7979 if ( lines ) {
8080 if ( lines [ 0 ] == lines [ 1 ] ) {
81- cb ( provider . webUrl ( branch , subdir , lines [ 0 ] ) ) ;
81+ cb ( provider . webUrl ( sha , subdir , lines [ 0 ] ) ) ;
8282 } else {
83- cb ( provider . webUrl ( branch , subdir , lines [ 0 ] , lines [ 1 ] ) ) ;
83+ cb ( provider . webUrl ( sha , subdir , lines [ 0 ] , lines [ 1 ] ) ) ;
8484 }
8585 } else {
86- cb ( provider . webUrl ( branch , subdir ) ) ;
86+ cb ( provider . webUrl ( sha , subdir ) ) ;
8787 }
8888 }
8989 } ) ;
@@ -177,10 +177,10 @@ function branchOnCallingContext(args, cb, pr) {
177177 return getGitProviderPullRequest ( args , cb ) ;
178178 }
179179
180- if ( args && args . fsPath ) {
181- getGitProviderLinkForFile ( args . fsPath , cb ) ;
182- } else if ( Window . activeTextEditor ) {
180+ if ( Window . activeTextEditor ) {
183181 getGitProviderLinkForCurrentEditorLines ( cb ) ;
182+ } else if ( args && args . fsPath ) {
183+ getGitProviderLinkForFile ( args . fsPath , cb ) ;
184184 } else {
185185 // TODO: This missed in code review so should be refactored, it is broken.
186186 getGitProviderLinkForRepo ( cb ) ;
0 commit comments