@@ -242,20 +242,28 @@ export class Model {
242242 const changeListener = repository . onDidChangeRepository ( uri => this . _onDidChangeRepository . fire ( { repository, uri } ) ) ;
243243 const originalResourceChangeListener = repository . onDidChangeOriginalResource ( uri => this . _onDidChangeOriginalResource . fire ( { repository, uri } ) ) ;
244244
245- const detectSubmodules = workspace
245+ const shouldDetectSubmodules = workspace
246246 . getConfiguration ( 'git' , Uri . file ( repository . root ) )
247247 . get < boolean > ( 'detectSubmodules' ) as boolean ;
248+
248249 const submodulesLimit = workspace
249250 . getConfiguration ( 'git' , Uri . file ( repository . root ) )
250251 . get < number > ( 'detectSubmodulesLimit' ) as number ;
251252
252253 const checkForSubmodules = ( ) => {
253- if ( detectSubmodules && repository . submodules . length > submodulesLimit ) {
254+ if ( ! shouldDetectSubmodules ) {
255+ return ;
256+ }
257+
258+ if ( repository . submodules . length > submodulesLimit ) {
254259 window . showWarningMessage ( localize ( 'too many submodules' , "The '{0}' repository has {1} submodules which won't be opened automatically. You can still open each one individually by opening a file within." , path . basename ( repository . root ) , repository . submodules . length ) ) ;
255260 statusListener . dispose ( ) ;
256261 }
257262
258- this . scanSubmodules ( repository , submodulesLimit ) ;
263+ repository . submodules
264+ . slice ( 0 , submodulesLimit )
265+ . map ( r => path . join ( repository . root , r . path ) )
266+ . forEach ( p => this . eventuallyScanPossibleGitRepository ( p ) ) ;
259267 } ;
260268
261269 const statusListener = repository . onDidRunGitStatus ( checkForSubmodules ) ;
@@ -277,21 +285,6 @@ export class Model {
277285 this . _onDidOpenRepository . fire ( repository ) ;
278286 }
279287
280- private scanSubmodules ( repository : Repository , limit : number ) : void {
281- const shouldScanSubmodules = workspace
282- . getConfiguration ( 'git' , Uri . file ( repository . root ) )
283- . get < boolean > ( 'detectSubmodules' ) === true ;
284-
285- if ( ! shouldScanSubmodules ) {
286- return ;
287- }
288-
289- repository . submodules
290- . slice ( 0 , limit )
291- . map ( r => path . join ( repository . root , r . path ) )
292- . forEach ( p => this . eventuallyScanPossibleGitRepository ( p ) ) ;
293- }
294-
295288 close ( repository : Repository ) : void {
296289 const openRepository = this . getOpenRepository ( repository ) ;
297290
0 commit comments