@@ -1572,7 +1572,7 @@ export class LocalGitProvider implements GitProvider, Disposable {
15721572 protected readonly unsafePaths = new Set < string > ( ) ;
15731573
15741574 @gate ( )
1575- @debug ( )
1575+ @debug ( { exit : true } )
15761576 async findRepositoryUri ( uri : Uri , isDirectory ?: boolean ) : Promise < Uri | undefined > {
15771577 const scope = getLogScope ( ) ;
15781578
@@ -2250,7 +2250,7 @@ export class LocalGitProvider implements GitProvider, Disposable {
22502250 return filterMap ( data . split ( '\n' ) , b => b . trim ( ) || undefined ) ;
22512251 }
22522252
2253- @log ( )
2253+ @log ( { exit : true } )
22542254 getCommitCount ( repoPath : string , ref : string ) : Promise < number | undefined > {
22552255 return this . git . rev_list__count ( repoPath , ref ) ;
22562256 }
@@ -2974,7 +2974,7 @@ export class LocalGitProvider implements GitProvider, Disposable {
29742974 }
29752975 }
29762976
2977- @log ( )
2977+ @log ( { exit : true } )
29782978 async getDefaultBranchName ( repoPath : string | undefined , remote ?: string ) : Promise < string | undefined > {
29792979 if ( repoPath == null ) return undefined ;
29802980
@@ -3302,14 +3302,16 @@ export class LocalGitProvider implements GitProvider, Disposable {
33023302 return files [ 0 ] ;
33033303 }
33043304
3305- @log ( )
3305+ @log ( { exit : true } )
33063306 async getFirstCommitSha ( repoPath : string ) : Promise < string | undefined > {
33073307 const data = await this . git . rev_list ( repoPath , 'HEAD' , { maxParents : 0 } ) ;
33083308 return data ?. [ 0 ] ;
33093309 }
33103310
33113311 @gate ( )
3312- @debug ( )
3312+ @debug < LocalGitProvider [ 'getGitDir' ] > ( {
3313+ exit : r => `returned ${ r . uri . toString ( true ) } , commonUri=${ r . commonUri ?. toString ( true ) } ` ,
3314+ } )
33133315 async getGitDir ( repoPath : string ) : Promise < GitDir > {
33143316 const repo = this . _repoInfoCache . get ( repoPath ) ;
33153317 if ( repo ?. gitDir != null ) return repo . gitDir ;
@@ -5727,7 +5729,7 @@ export class LocalGitProvider implements GitProvider, Disposable {
57275729 }
57285730 }
57295731
5730- @log ( )
5732+ @log ( { exit : true } )
57315733 async getScmRepository ( repoPath : string ) : Promise < ScmRepository | undefined > {
57325734 const scope = getLogScope ( ) ;
57335735 try {
@@ -5739,19 +5741,20 @@ export class LocalGitProvider implements GitProvider, Disposable {
57395741 }
57405742 }
57415743
5742- @log ( )
5744+ @log ( { exit : true } )
57435745 async getOrOpenScmRepository ( repoPath : string | Uri ) : Promise < ScmRepository | undefined > {
57445746 const scope = getLogScope ( ) ;
57455747 try {
57465748 const uri = repoPath instanceof Uri ? repoPath : Uri . file ( repoPath ) ;
57475749 const gitApi = await this . getScmGitApi ( ) ;
5750+ if ( gitApi == null ) return undefined ;
57485751
5749- let repo = gitApi ?. getRepository ( uri ) ?? undefined ;
5750- if ( repo == null && gitApi ?. openRepository != null ) {
5751- repo = ( await gitApi ?. openRepository ?.( uri ) ) ?? undefined ;
5752+ let repo = gitApi . getRepository ( uri ) ;
5753+ if ( repo == null ) {
5754+ Logger . debug ( scope , '\u2022 no existing repository found, opening repository...' ) ;
5755+ repo ??= await gitApi . openRepository ?.( uri ) ;
57525756 }
5753-
5754- return repo ;
5757+ return repo ?? undefined ;
57555758 } catch ( ex ) {
57565759 Logger . error ( ex , scope ) ;
57575760 return undefined ;
0 commit comments