@@ -492,10 +492,11 @@ export class GitProviderService implements Disposable {
492492 }
493493
494494 if ( e . changed ( RepositoryChange . Remotes , RepositoryChangeComparisonMode . Any ) ) {
495- const remotes = await provider . getRemotes ( e . repository . path ) ;
496495 const visibilityInfo = this . getVisibilityInfoFromCache ( e . repository . path ) ;
497496 if ( visibilityInfo != null ) {
498- this . checkVisibilityCachedRemotes ( e . repository . path , visibilityInfo , remotes ) ;
497+ await this . checkVisibilityCachedRemotes ( e . repository . path , visibilityInfo , ( ) =>
498+ provider . getRemotes ( e . repository . path ) ,
499+ ) ;
499500 }
500501 }
501502
@@ -920,20 +921,21 @@ export class GitProviderService implements Disposable {
920921 return visibilityInfo ;
921922 }
922923
923- private checkVisibilityCachedRemotes (
924+ private async checkVisibilityCachedRemotes (
924925 key : string ,
925926 visibilityInfo : RepositoryVisibilityInfo | undefined ,
926- remotes : GitRemote [ ] ,
927- ) : boolean {
927+ getRemotes : ( ) => Promise < GitRemote [ ] > ,
928+ ) : Promise < boolean > {
928929 if ( visibilityInfo == null ) return true ;
929930
930931 if ( visibilityInfo . visibility === 'public' ) {
932+ const remotes = await getRemotes ( ) ;
931933 if ( remotes . length === 0 || ! remotes . some ( r => r . remoteKey === visibilityInfo . remotesHash ) ) {
932934 void this . clearRepoVisibilityCache ( [ key ] ) ;
933935 return false ;
934936 }
935937 } else if ( visibilityInfo . visibility === 'private' ) {
936- const remotesHash = getVisibilityCacheKey ( remotes ) ;
938+ const remotesHash = getVisibilityCacheKey ( await getRemotes ( ) ) ;
937939 if ( remotesHash !== visibilityInfo . remotesHash ) {
938940 void this . clearRepoVisibilityCache ( [ key ] ) ;
939941 return false ;
@@ -1010,9 +1012,13 @@ export class GitProviderService implements Disposable {
10101012 repoPath : string | Uri ,
10111013 ) : Promise < RepositoryVisibility > {
10121014 const { provider, path } = this . getProvider ( repoPath ) ;
1013- const remotes = await provider . getRemotes ( path , { sort : true } ) ;
10141015 const visibilityInfo = this . getVisibilityInfoFromCache ( path ) ;
1015- if ( visibilityInfo == null || ! this . checkVisibilityCachedRemotes ( path , visibilityInfo , remotes ) ) {
1016+ if (
1017+ visibilityInfo == null ||
1018+ ! ( await this . checkVisibilityCachedRemotes ( path , visibilityInfo , ( ) =>
1019+ provider . getRemotes ( path , { sort : true } ) ,
1020+ ) )
1021+ ) {
10161022 const [ visibility , remotesHash ] = await provider . visibility ( path ) ;
10171023 if ( visibility !== 'local' ) {
10181024 this . updateVisibilityCache ( path , {
0 commit comments