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

Commit be45db5

Browse files
Adding functionality to check the MD5 of the git lfs exec
1 parent e6762b5 commit be45db5

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/GitHub.Api/Installer/GitInstaller.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ class GitInstallDetails
1111
public string GitLfsExec { get; }
1212
public NPath GitLfsExecPath { get; }
1313

14+
public const string WindowsGitLfsExecutableMD5 = "177bb14d0c08f665a24f0d5516c3b080";
15+
public const string MacGitLfsExecutableMD5 = "f81a1a065a26a4123193e8fd96c561ad";
16+
1417
public const string ExtractedMD5 = "65fd0575d3b47d8207b9e19d02faca4f";
1518
public const string FileListMD5 = "a152a216b2e76f6c127053251187a278";
1619

@@ -166,6 +169,14 @@ private bool IsGitExtracted()
166169
return false;
167170
}
168171

172+
var calculateMd5 = environment.FileSystem.CalculateFileMD5(installDetails.GitLfsExecPath);
173+
var md5 = environment.IsWindows ? GitInstallDetails.WindowsGitLfsExecutableMD5 : GitInstallDetails.MacGitLfsExecutableMD5;
174+
if (md5.Equals(calculateMd5, StringComparison.InvariantCultureIgnoreCase))
175+
{
176+
Logger.Trace("{0} has MD5 {1} Excepted {2}", installDetails.GitLfsExecPath, calculateMd5, md5);
177+
return false;
178+
}
179+
169180
Logger.Trace("Git Present");
170181
return true;
171182
}

0 commit comments

Comments
 (0)