@@ -60,12 +60,17 @@ export class Addon {
6060 await this . getEnabled ( ) ;
6161
6262 if ( this . #installed) {
63- tags = ( await moduleGit . tags ( [ "--sort=-taggerdate" ] ) ) . all ;
63+ tags = (
64+ await moduleGit . tags ( [
65+ "--sort=-taggerdate" ,
66+ "--merged" ,
67+ `origin/${ await this . getDefaultBranch ( ) } ` ,
68+ ] )
69+ ) . all ;
6470
6571 const currentTag = await moduleGit
6672 . raw ( [ "describe" , "--tags" , "--exact-match" ] )
6773 . catch ( ( err ) => {
68- localLogger . warn ( err ) ;
6974 return null ;
7075 } ) ;
7176 const commitsBehindLatest = await moduleGit . raw ( [
@@ -82,7 +87,9 @@ export class Addon {
8287 currentVersion = await moduleGit
8388 . revparse ( [ "--short" , "HEAD" ] )
8489 . catch ( ( err ) => {
85- localLogger . warn ( err ) ;
90+ localLogger . warn (
91+ `Failed to get current hash for ${ this . name } : ${ err } `
92+ ) ;
8693 return null ;
8794 } ) ;
8895 }
@@ -126,8 +133,20 @@ export class Addon {
126133 }
127134
128135 public async getDefaultBranch ( ) {
129- const modulePath = vscode . Uri . joinPath ( this . uri , "module" ) ;
136+ // Get branch from .gitmodules if specified
137+ const targetBranch = await git . raw (
138+ "config" ,
139+ "-f" ,
140+ ".gitmodules" ,
141+ "--get" ,
142+ `submodule.addons/${ this . name } /module.branch`
143+ ) ;
144+ if ( targetBranch ) {
145+ return targetBranch ;
146+ }
130147
148+ // Fetch default branch from remote
149+ const modulePath = vscode . Uri . joinPath ( this . uri , "module" ) ;
131150 const result = ( await git
132151 . cwd ( { path : modulePath . fsPath , root : false } )
133152 . remote ( [ "show" , "origin" ] ) ) as string ;
@@ -179,9 +198,10 @@ export class Addon {
179198 ) ;
180199
181200 const moduleURI = vscode . Uri . joinPath ( this . uri , "module" ) ;
182- this . #installed =
183- ( await filesystem . exists ( moduleURI ) ) &&
184- ( ( await filesystem . readDirectory ( moduleURI , { recursive : false } ) ) ?. length ?? 0 ) > 0 ;
201+
202+ const exists = await filesystem . exists ( moduleURI ) ;
203+ const empty = await filesystem . empty ( moduleURI ) ;
204+ this . #installed = exists && ! empty ;
185205
186206 return folderStates ;
187207 }
0 commit comments