@@ -26,10 +26,12 @@ public string LocalRepositoryName
2626 {
2727 get
2828 {
29- var activeRepo = vsGitServices . GetActiveRepo ( ) ;
30- if ( ! string . IsNullOrEmpty ( activeRepo ? . Info ? . WorkingDirectory ) )
31- return new DirectoryInfo ( activeRepo . Info . WorkingDirectory ) . Name ?? "" ;
32- return string . Empty ;
29+ using ( var activeRepo = vsGitServices . GetActiveRepo ( ) )
30+ {
31+ if ( ! string . IsNullOrEmpty ( activeRepo ? . Info ? . WorkingDirectory ) )
32+ return new DirectoryInfo ( activeRepo . Info . WorkingDirectory ) . Name ?? "" ;
33+ return string . Empty ;
34+ }
3335 }
3436 }
3537
@@ -43,11 +45,14 @@ public string LocalRepositoryName
4345 . Select ( remoteRepo => new { RemoteRepo = remoteRepo , LocalRepo = vsGitServices . GetActiveRepo ( ) } ) )
4446 . SelectMany ( async repo =>
4547 {
46- await gitClient . SetRemote ( repo . LocalRepo , "origin" , new Uri ( repo . RemoteRepo . CloneUrl ) ) ;
47- await gitClient . Push ( repo . LocalRepo , "master" , "origin" ) ;
48- await gitClient . Fetch ( repo . LocalRepo , "origin" ) ;
49- await gitClient . SetTrackingBranch ( repo . LocalRepo , "master" , "origin" ) ;
50- return repo . RemoteRepo ;
48+ using ( repo . LocalRepo )
49+ {
50+ await gitClient . SetRemote ( repo . LocalRepo , "origin" , new Uri ( repo . RemoteRepo . CloneUrl ) ) ;
51+ await gitClient . Push ( repo . LocalRepo , "master" , "origin" ) ;
52+ await gitClient . Fetch ( repo . LocalRepo , "origin" ) ;
53+ await gitClient . SetTrackingBranch ( repo . LocalRepo , "master" , "origin" ) ;
54+ return repo . RemoteRepo ;
55+ }
5156 } ) ;
5257 }
5358 }
0 commit comments