@@ -36,6 +36,7 @@ public class VSGitServices : IVSGitServices
3636
3737 [ SuppressMessage ( "Microsoft.Performance" , "CA1823:AvoidUnusedPrivateFields" , Justification = "Used in VS2017" ) ]
3838 readonly Lazy < IStatusBarNotificationService > statusBar ;
39+ readonly Lazy < IVSServices > vsServices ;
3940
4041 /// <summary>
4142 /// This MEF export requires specific versions of TeamFoundation. IGitExt is declared here so
@@ -46,10 +47,13 @@ public class VSGitServices : IVSGitServices
4647 IGitExt gitExtService ;
4748
4849 [ ImportingConstructor ]
49- public VSGitServices ( IGitHubServiceProvider serviceProvider , Lazy < IStatusBarNotificationService > statusBar )
50+ public VSGitServices ( IGitHubServiceProvider serviceProvider ,
51+ Lazy < IStatusBarNotificationService > statusBar ,
52+ Lazy < IVSServices > vsServices )
5053 {
5154 this . serviceProvider = serviceProvider ;
5255 this . statusBar = statusBar ;
56+ this . vsServices = vsServices ;
5357 }
5458
5559 // The Default Repository Path that VS uses is hidden in an internal
@@ -86,9 +90,15 @@ public async Task Clone(
8690 gitExt . Clone ( cloneUrl , clonePath , recurseSubmodules ? CloneOptions . RecurseSubmodule : CloneOptions . None ) ;
8791
8892 // The operation will have completed when CanClone goes false and then true again.
93+ // It looks like the CanClone property is only live as long as the Connect page is visible.
8994 await gitExt . WhenAnyValue ( x => x . CanClone ) . Where ( x => ! x ) . Take ( 1 ) ; // Wait until started
90- NavigateToHomePage ( teamExplorer ) ; // Show progress on Team Explorer - Home
9195 await gitExt . WhenAnyValue ( x => x . CanClone ) . Where ( x => x ) . Take ( 1 ) ; // Wait until completed
96+
97+ // Show progress on Team Explorer - Home
98+ NavigateToHomePage ( teamExplorer ) ;
99+
100+ // Open cloned repository in Team Explorer
101+ vsServices . Value . TryOpenRepository ( clonePath ) ;
92102#else
93103 var gitExt = serviceProvider . GetService < IGitActionsExt > ( ) ;
94104 var typedProgress = ( ( Progress < ServiceProgressData > ) progress ) ?? new Progress < ServiceProgressData > ( ) ;
0 commit comments