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

Commit 5eec978

Browse files
committed
Use IGitExt instead of internal SccService
Force SccProviderPackage to load by getting IGitExt instead of the internal SccService.
1 parent ae3e2ae commit 5eec978

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

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

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -88,24 +88,20 @@ public async Task Clone(
8888
#elif TEAMEXPLORER15 || TEAMEXPLORER16
8989
// IGitActionsExt is proffered by SccProviderPackage, but isn't advertised.
9090
// To ensure that getting IGitActionsExt doesn't return null, we first request the
91-
// SccService which is advertised. This forces SccProviderPackage to load
91+
// IGitExt service which is advertised. This forces SccProviderPackage to load
9292
// and proffer IGitActionsExt.
93-
var gitSccServiceGuid = new Guid("28C35EB2-67EA-4C5F-B49D-DACF73A66989");
94-
var gitSccServiceType = Type.GetTypeFromCLSID(gitSccServiceGuid);
95-
var gitSccService = serviceProvider.GetService(gitSccServiceType);
96-
if (gitSccService is null)
97-
{
98-
log.Warning("Couldn't find Git SccService with Guid {Guid}", gitSccServiceGuid);
99-
}
93+
var gitExt = serviceProvider.GetService(typeof(IGitExt));
94+
Assumes.NotNull(gitExt);
95+
var gitActionsExt = serviceProvider.GetService<IGitActionsExt>();
96+
Assumes.NotNull(gitActionsExt);
10097

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

110106
NavigateToHomePage(teamExplorer); // Show progress on Team Explorer - Home
111107
await cloneTask;

0 commit comments

Comments
 (0)