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

Commit 8067273

Browse files
committed
Increment NumberOf*Opens counters
Increment NumberOfGitHubOpens and NumberOfEnterpriseOpens counters when CloneOrOpenRepository is called.
1 parent af55f6a commit 8067273

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/GitHub.App/Services/RepositoryCloneService.cs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,15 @@ public async Task CloneOrOpenRepository(
126126
if (DestinationDirectoryExists(repositoryPath))
127127
{
128128
teamExplorerServices.OpenRepository(repositoryPath);
129+
130+
if (isDotCom)
131+
{
132+
await usageTracker.IncrementCounter(x => x.NumberOfGitHubOpens);
133+
}
134+
else
135+
{
136+
await usageTracker.IncrementCounter(x => x.NumberOfEnterpriseOpens);
137+
}
129138
}
130139
else
131140
{
@@ -138,7 +147,6 @@ public async Task CloneOrOpenRepository(
138147
}
139148
else
140149
{
141-
// If it isn't a GitHub URL, assume it's an Enterprise URL
142150
await usageTracker.IncrementCounter(x => x.NumberOfEnterpriseClones);
143151
}
144152
}
@@ -174,10 +182,10 @@ public async Task CloneRepository(
174182
}
175183

176184
/// <inheritdoc/>
177-
public bool DestinationDirectoryExists(string path) => Directory.Exists(path);
185+
public bool DestinationDirectoryExists(string path) => operatingSystem.Directory.DirectoryExists(path);
178186

179187
/// <inheritdoc/>
180-
public bool DestinationFileExists(string path) => File.Exists(path);
188+
public bool DestinationFileExists(string path) => operatingSystem.File.Exists(path);
181189

182190
string GetLocalClonePathFromGitProvider(string fallbackPath)
183191
{

0 commit comments

Comments
 (0)