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

Commit e672ac3

Browse files
Integating download functionality
1 parent 65da7df commit e672ac3

File tree

1 file changed

+27
-4
lines changed

1 file changed

+27
-4
lines changed

src/GitHub.Api/Installer/GitInstaller.cs

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,36 @@ public void SetupGitIfNeeded(ActionTask<NPath> onSuccess, ITask onFailure)
9999
else
100100
{
101101
var tempZipPath = NPath.CreateTempDirectory("git_zip_paths");
102-
var gitArchivePath = AssemblyResources.ToFile(ResourceType.Platform, "git.zip", tempZipPath, environment);
103-
var gitLfsArchivePath = AssemblyResources.ToFile(ResourceType.Platform, "git-lfs.zip", tempZipPath, environment);
104-
102+
var gitArchivePath = tempZipPath.Combine("git.zip");
103+
var gitLfsArchivePath = tempZipPath.Combine("git-lfs.zip");
105104
var gitExtractPath = tempZipPath.Combine("git").CreateDirectory();
106105
var gitLfsExtractPath = tempZipPath.Combine("git-lfs").CreateDirectory();
107106

108-
new UnzipTask(cancellationToken, gitArchivePath, gitExtractPath, sharpZipLibHelper)
107+
var downloadGitMd5Task = new DownloadTextTask(CancellationToken.None,
108+
"https://ghfvs-installer.github.com/unity/portable_git/git.zip.MD5.txt?cb=1");
109+
110+
var downloadGitTask = new DownloadTask(CancellationToken.None, environment.FileSystem,
111+
"https://ghfvs-installer.github.com/unity/portable_git/git.zip", gitArchivePath, retryCount: 1);
112+
113+
var downloadGitLfsMd5Task = new DownloadTextTask(CancellationToken.None,
114+
"https://ghfvs-installer.github.com/unity/portable_git/git-lfs.zip.MD5.txt?cb=1");
115+
116+
var downloadGitLfsTask = new DownloadTask(CancellationToken.None, environment.FileSystem,
117+
"https://ghfvs-installer.github.com/unity/portable_git/git-lfs.zip", gitLfsArchivePath, retryCount: 1);
118+
119+
downloadGitMd5Task
120+
.Then((b, s) =>
121+
{
122+
downloadGitTask.ValidationHash = s;
123+
})
124+
.Then(downloadGitTask)
125+
.Then(downloadGitLfsMd5Task)
126+
.Then((b, s) =>
127+
{
128+
downloadGitLfsTask.ValidationHash = s;
129+
})
130+
.Then(downloadGitLfsTask)
131+
.Then(new UnzipTask(cancellationToken, gitArchivePath, gitExtractPath, sharpZipLibHelper))
109132
.Then(new UnzipTask(cancellationToken, gitLfsArchivePath, gitLfsExtractPath, sharpZipLibHelper))
110133
.Then(() => {
111134
var targetGitLfsExecPath = installDetails.GetGitLfsExecPath(gitExtractPath);

0 commit comments

Comments
 (0)