Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit 8952f96

Browse files
committed
TryOpenRepository when clone completes on VS 2015
We want the Clone behavior to be as similar as possible on Visual Studio 2015 and 2017.
1 parent a5a2b1a commit 8952f96

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/GitHub.TeamFoundation.14/Services/VSGitServices.cs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)