Skip to content
This repository was archived by the owner on Dec 5, 2024. It is now read-only.

Commit cb72dd9

Browse files
authored
Merge branch 'master' into enhancements/gitcheckout
2 parents e24a878 + 2e27a09 commit cb72dd9

File tree

2 files changed

+20
-21
lines changed

2 files changed

+20
-21
lines changed

src/GitHub.Api/Installer/GitInstaller.cs

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,12 @@ class GitInstallDetails
1414
public const string GitExtractedMD5 = "e6cfc0c294a2312042f27f893dfc9c0a";
1515
public const string GitLfsExtractedMD5 = "36e3ae968b69fbf42dff72311040d24a";
1616

17+
public const string WindowsGitExecutableMD5 = "50570ed932559f294d1a1361801740b9";
18+
public const string MacGitExecutableMD5 = "";
19+
1720
public const string WindowsGitLfsExecutableMD5 = "177bb14d0c08f665a24f0d5516c3b080";
1821
public const string MacGitLfsExecutableMD5 = "f81a1a065a26a4123193e8fd96c561ad";
1922

20-
public const string FileListMD5 = "a152a216b2e76f6c127053251187a278";
21-
2223
private const string PackageVersion = "f02737a78695063deace08e96d5042710d3e32db";
2324
private const string PackageName = "PortableGit";
2425

@@ -209,19 +210,21 @@ private bool IsGitExtracted()
209210
return false;
210211
}
211212

212-
var fileListMD5 = environment.FileSystem.CalculateFolderMD5(installDetails.GitInstallationPath, false);
213-
if (!fileListMD5.Equals(GitInstallDetails.FileListMD5, StringComparison.InvariantCultureIgnoreCase))
213+
var gitExecutableMd5 = environment.FileSystem.CalculateFileMD5(installDetails.GitExecutablePath);
214+
var expectedGitExecutableMd5 = environment.IsWindows ? GitInstallDetails.WindowsGitExecutableMD5 : GitInstallDetails.MacGitExecutableMD5;
215+
216+
if (!expectedGitExecutableMd5.Equals(gitExecutableMd5, StringComparison.InvariantCultureIgnoreCase))
214217
{
215-
Logger.Warning($"Path {installDetails.GitInstallationPath} has MD5 {fileListMD5} expected {GitInstallDetails.FileListMD5}");
218+
Logger.Warning($"Path {installDetails.GitExecutablePath} has MD5 {gitExecutableMd5} expected {expectedGitExecutableMd5}");
216219
return false;
217220
}
218221

219-
var calculateMd5 = environment.FileSystem.CalculateFileMD5(installDetails.GitLfsExecutablePath);
220-
var md5 = environment.IsWindows ? GitInstallDetails.WindowsGitLfsExecutableMD5 : GitInstallDetails.MacGitLfsExecutableMD5;
222+
var gitLfsExecutableMd5 = environment.FileSystem.CalculateFileMD5(installDetails.GitLfsExecutablePath);
223+
var expectedGitLfsExecutableMd5 = environment.IsWindows ? GitInstallDetails.WindowsGitLfsExecutableMD5 : GitInstallDetails.MacGitLfsExecutableMD5;
221224

222-
if (!md5.Equals(calculateMd5, StringComparison.InvariantCultureIgnoreCase))
225+
if (!expectedGitLfsExecutableMd5.Equals(gitLfsExecutableMd5, StringComparison.InvariantCultureIgnoreCase))
223226
{
224-
Logger.Warning($"Path {installDetails.GitLfsExecutablePath} has MD5 {calculateMd5} expected {md5}");
227+
Logger.Warning($"Path {installDetails.GitLfsExecutablePath} has MD5 {gitLfsExecutableMd5} expected {expectedGitLfsExecutableMd5}");
225228
return false;
226229
}
227230

src/tests/IntegrationTests/Git/GitClientTests.cs

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,40 +10,36 @@ namespace IntegrationTests
1010
class GitClientTests : BaseGitEnvironmentTest
1111
{
1212
[Test]
13-
public void ShouldGetGitVersion()
13+
public async Task ShouldGetGitVersion()
1414
{
1515
Initialize(TestRepoMasterCleanSynchronized);
1616

17-
var version = GitClient.Version();
18-
version.Start().Wait();
17+
var result = await GitClient.Version().StartAwait();
1918

20-
var versionResult = version.Result;
2119
if (Environment.IsWindows)
2220
{
23-
versionResult.Should().Be(new Version(2,11,1));
21+
result.Should().Be(new Version(2,11,1));
2422
}
2523
else
2624
{
27-
versionResult.Should().NotBeNull();
25+
result.Should().NotBeNull();
2826
}
2927
}
3028

3129
[Test]
32-
public void ShouldGetGitLfsVersion()
30+
public async Task ShouldGetGitLfsVersion()
3331
{
3432
Initialize(TestRepoMasterCleanSynchronized);
3533

36-
var version = GitClient.LfsVersion();
37-
version.Start().Wait();
34+
var result = await GitClient.LfsVersion().StartAwait();
3835

39-
var versionResult = version.Result;
4036
if (Environment.IsWindows)
4137
{
42-
versionResult.Should().Be(new Version(2, 3, 4));
38+
result.Should().Be(new Version(2, 3, 4));
4339
}
4440
else
4541
{
46-
versionResult.Should().NotBeNull();
42+
result.Should().NotBeNull();
4743
}
4844
}
4945
}

0 commit comments

Comments
 (0)