@@ -41,11 +41,19 @@ export class WorktreesRepositoryNode extends RepositoryFolderNode<WorktreesView,
4141}
4242
4343export class WorktreesViewNode extends RepositoriesSubscribeableNode < WorktreesView , WorktreesRepositoryNode > {
44+ protected override getViewDescription ( count ?: number ) : string {
45+ const description = super . getViewDescription ( count ) ;
46+ return description ? `${ description } \u00a0\u2022\u00a0 ${ proBadge } ` : proBadge ;
47+ }
48+
4449 async getChildren ( ) : Promise < ViewNode [ ] > {
45- const access = await this . view . container . git . access ( PlusFeatures . Worktrees ) ;
46- if ( access . allowed === false ) return [ ] ;
50+ this . view . description = this . getViewDescription ( ) ;
51+ this . view . message = undefined ;
4752
4853 if ( this . children == null ) {
54+ const access = await this . view . container . git . access ( PlusFeatures . Worktrees ) ;
55+ if ( access . allowed === false ) return [ ] ;
56+
4957 let repositories = this . view . container . git . openRepositories ;
5058 if ( configuration . get ( 'views.collapseWorktreesWhenPossible' ) ) {
5159 const grouped = await groupRepositories ( repositories ) ;
@@ -60,8 +68,6 @@ export class WorktreesViewNode extends RepositoriesSubscribeableNode<WorktreesVi
6068 return [ ] ;
6169 }
6270
63- this . view . message = undefined ;
64-
6571 const splat = repositories . length === 1 ;
6672 this . children = repositories . map (
6773 r => new WorktreesRepositoryNode ( GitUri . fromRepoPath ( r . path ) , this . view , this , r , splat ) ,
@@ -71,33 +77,16 @@ export class WorktreesViewNode extends RepositoriesSubscribeableNode<WorktreesVi
7177 if ( this . children . length === 1 ) {
7278 const [ child ] = this . children ;
7379
74- const children = await child . getChildren ( ) ;
75- if ( children . length <= 1 ) {
76- this . view . message = undefined ;
77- if ( ! this . view . grouped ) {
78- this . view . description = proBadge ;
79- }
80-
80+ const grandChildren = await child . getChildren ( ) ;
81+ if ( grandChildren . length <= 1 ) {
8182 void child . ensureSubscription ( ) ;
8283
8384 return [ ] ;
8485 }
8586
86- this . view . message = undefined ;
87-
88- if ( this . view . grouped ) {
89- this . view . description = `${ this . view . name . toLocaleLowerCase ( ) } (${
90- children . length
91- } ) \u00a0\u2022\u00a0 ${ proBadge } `;
92- } else {
93- this . view . description = `(${ children . length } ) \u00a0\u2022\u00a0 ${ proBadge } ` ;
94- }
95-
96- return children ;
97- }
87+ this . view . description = this . getViewDescription ( grandChildren . length ) ;
9888
99- if ( ! this . view . grouped ) {
100- this . view . description = proBadge ;
89+ return grandChildren ;
10190 }
10291
10392 return this . children ;
0 commit comments