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

Commit cc1c247

Browse files
committed
Explicitly open repository when clone completes
Explicitly open repository on Visual Studio 2015 and 2017. Although this sometimes happens automatically on Visual Studio 2017, it doesn't happen consistently.
1 parent 5f502af commit cc1c247

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public class VSGitServices : IVSGitServices
3737
[SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields", Justification = "Used in VS2017")]
3838
readonly Lazy<IStatusBarNotificationService> statusBar;
3939
[SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields", Justification = "Used in VS2015")]
40-
readonly Lazy<IVSServices> vsServices;
40+
readonly Lazy<ITeamExplorerServices> teamExplorerServices;
4141

4242
/// <summary>
4343
/// This MEF export requires specific versions of TeamFoundation. IGitExt is declared here so
@@ -50,11 +50,11 @@ public class VSGitServices : IVSGitServices
5050
[ImportingConstructor]
5151
public VSGitServices(IGitHubServiceProvider serviceProvider,
5252
Lazy<IStatusBarNotificationService> statusBar,
53-
Lazy<IVSServices> vsServices)
53+
Lazy<ITeamExplorerServices> teamExplorerServices)
5454
{
5555
this.serviceProvider = serviceProvider;
5656
this.statusBar = statusBar;
57-
this.vsServices = vsServices;
57+
this.teamExplorerServices = teamExplorerServices;
5858
}
5959

6060
// The Default Repository Path that VS uses is hidden in an internal
@@ -90,7 +90,6 @@ public async Task Clone(
9090
await StartClonenOnConnectPageAsync(teamExplorer, cloneUrl, clonePath, recurseSubmodules);
9191
NavigateToHomePage(teamExplorer); // Show progress on Team Explorer - Home
9292
await WaitForCloneOnHomePageAsync(teamExplorer);
93-
vsServices.Value.TryOpenRepository(clonePath); // Show the repository on Team Explorer - Home
9493
#else
9594
var gitExt = serviceProvider.GetService<IGitActionsExt>();
9695
var typedProgress = ((Progress<ServiceProgressData>)progress) ?? new Progress<ServiceProgressData>();
@@ -100,6 +99,8 @@ public async Task Clone(
10099
NavigateToHomePage(teamExplorer); // Show progress on Team Explorer - Home
101100
await cloneTask;
102101
#endif
102+
// Change Team Explorer context to the newly cloned repository
103+
teamExplorerServices.Value.OpenRepository(clonePath);
103104
}
104105

105106
static async Task StartClonenOnConnectPageAsync(

0 commit comments

Comments
 (0)