Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions src/GitHub.TeamFoundation.14/Services/VSGitServices.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,22 @@ public async Task Clone(
NavigateToHomePage(teamExplorer); // Show progress on Team Explorer - Home
await WaitForCloneOnHomePageAsync(teamExplorer);
#elif TEAMEXPLORER15 || TEAMEXPLORER16
// IGitActionsExt is proffered by SccProviderPackage, but isn't advertised.
// To ensure that getting IGitActionsExt doesn't return null, we first request the
// IGitExt service which is advertised. This forces SccProviderPackage to load
// and proffer IGitActionsExt.
var gitExt = serviceProvider.GetService(typeof(IGitExt));
Assumes.NotNull(gitExt);
var gitActionsExt = serviceProvider.GetService<IGitActionsExt>();
Assumes.NotNull(gitActionsExt);

// The progress parameter uses the ServiceProgressData type which is defined in
// Microsoft.VisualStudio.Shell.Framework. Referencing this assembly directly
// would cause type conflicts, so we're using reflection to call CloneAsync.
var gitExt = serviceProvider.GetService<IGitActionsExt>();
var cloneAsyncMethod = typeof(IGitActionsExt).GetMethod(nameof(IGitActionsExt.CloneAsync));
Assumes.NotNull(cloneAsyncMethod);
var cloneParameters = new object[] { cloneUrl, clonePath, recurseSubmodules, cancellationToken, progress };
var cloneTask = (Task)cloneAsyncMethod.Invoke(gitExt, cloneParameters);
var cloneTask = (Task)cloneAsyncMethod.Invoke(gitActionsExt, cloneParameters);

NavigateToHomePage(teamExplorer); // Show progress on Team Explorer - Home
await cloneTask;
Expand Down