@@ -4,12 +4,11 @@ import {
44 IssuesCloudHostIntegrationId ,
55} from '../../../constants.integrations' ;
66import type { GitReference } from '../../../git/models/reference' ;
7- import { RemoteResourceType } from '../../../git/models/remoteResource' ;
87import type { Repository } from '../../../git/models/repository' ;
98import type { GkProviderId } from '../../../git/models/repositoryIdentities' ;
109import type { RemoteProviderId } from '../../../git/remotes/remoteProvider' ;
10+ import { toRepositoryShapeWithProvider } from '../../../git/utils/-webview/repository.utils' ;
1111import { isGitReference } from '../../../git/utils/reference.utils' ;
12- import { convertRemoteProviderIdToIntegrationId } from '../../../plus/integrations/utils/-webview/integration.utils' ;
1312import type { Unbrand } from '../../../system/brand' ;
1413import { getSettledValue } from '../../../system/promise' ;
1514import { isWebviewItemContext , isWebviewItemGroupContext } from '../../../system/webview' ;
@@ -34,33 +33,14 @@ import type {
3433} from './protocol' ;
3534
3635export async function formatRepositories ( repositories : Repository [ ] ) : Promise < GraphRepository [ ] > {
37- if ( repositories . length === 0 ) return Promise . resolve ( [ ] ) ;
36+ if ( ! repositories . length ) return [ ] ;
3837
3938 const result = await Promise . allSettled (
4039 repositories . map < Promise < GraphRepository > > ( async repo => {
4140 const remotes = await repo . git . remotes . getBestRemotesWithProviders ( ) ;
4241 const remote = remotes . find ( r => r . supportsIntegration ( ) ) ?? remotes [ 0 ] ;
4342
44- return {
45- formattedName : repo . name ,
46- id : repo . id ,
47- name : repo . name ,
48- path : repo . path ,
49- provider : remote ?. provider
50- ? {
51- name : remote . provider . name ,
52- integration : remote . supportsIntegration ( )
53- ? {
54- id : convertRemoteProviderIdToIntegrationId ( remote . provider . id ) ! ,
55- connected : remote . maybeIntegrationConnected ?? false ,
56- }
57- : undefined ,
58- icon : remote . provider . icon === 'remote' ? 'cloud' : remote . provider . icon ,
59- url : await remote . provider . url ( { type : RemoteResourceType . Repo } ) ,
60- }
61- : undefined ,
62- isVirtual : repo . provider . virtual ,
63- } ;
43+ return toRepositoryShapeWithProvider ( repo , remote ) ;
6444 } ) ,
6545 ) ;
6646 return result . map ( r => getSettledValue ( r ) ) . filter ( r => r != null ) ;
0 commit comments