@@ -169,72 +169,71 @@ public override void OnSetup()
169
169
[ Test ]
170
170
public void GitLfsIsInstalledIfMissing ( )
171
171
{
172
- var gitInstallationPath = TestBasePath . Combine ( "GitInstall" ) . CreateDirectory ( ) ;
173
-
174
- var installDetails = new GitInstaller . GitInstallDetails ( gitInstallationPath , DefaultEnvironment . OnWindows )
175
- {
176
- GitPackageFeed = $ "http://localhost:{ server . Port } /unity/git/windows/{ GitInstaller . GitInstallDetails . GitPackageName } ",
177
- GitLfsPackageFeed = $ "http://localhost:{ server . Port } /unity/git/windows/{ GitInstaller . GitInstallDetails . GitLfsPackageName } ",
178
- } ;
172
+ var tempZipExtractPath = TestBasePath . Combine ( "Temp" , "git_zip_extract_zip_paths" ) ;
173
+ var gitInstallationPath = TestBasePath . Combine ( "GitInstall" ) . Combine ( GitInstaller . GitInstallDetails . GitDirectory ) ;
174
+ var gitLfsInstallationPath = TestBasePath . Combine ( "GitInstall" ) . Combine ( GitInstaller . GitInstallDetails . GitLfsDirectory ) ;
179
175
180
- var package = Package . Load ( Environment , installDetails . GitPackageFeed ) ;
176
+ var gitZipUri = new UriString ( $ "http://localhost: { server . Port } /unity/git/windows/git-slim.zip" ) ;
181
177
var downloader = new Downloader ( ) ;
182
- downloader . Catch ( e => true ) ;
183
- downloader . QueueDownload ( package . Uri , installDetails . ZipPath ) ;
178
+ downloader . QueueDownload ( gitZipUri , tempZipExtractPath ) ;
184
179
downloader . RunWithReturn ( true ) ;
185
180
186
- var tempZipExtractPath = TestBasePath . Combine ( "Temp" , "git_zip_extract_zip_paths" ) ;
187
-
188
181
var gitExtractPath = tempZipExtractPath . Combine ( "git" ) . CreateDirectory ( ) ;
189
- ZipHelper . Instance . Extract ( installDetails . GitZipPath , gitExtractPath , TaskManager . Token , null ) ;
182
+ ZipHelper . Instance . Extract ( tempZipExtractPath . Combine ( gitZipUri . Filename ) , gitExtractPath , TaskManager . Token , null ) ;
190
183
var source = gitExtractPath ;
191
- var target = installDetails . GitInstallationPath ;
184
+ var target = gitInstallationPath ;
192
185
target . DeleteIfExists ( ) ;
193
186
target . EnsureParentDirectoryExists ( ) ;
194
187
source . Move ( target ) ;
195
188
189
+ var installDetails = new GitInstaller . GitInstallDetails ( gitInstallationPath . Parent , DefaultEnvironment . OnWindows )
190
+ {
191
+ GitPackageFeed = "http://nope" ,
192
+ GitLfsPackageFeed = $ "http://localhost:{ server . Port } /unity/git/windows/{ GitInstaller . GitInstallDetails . GitLfsPackageName } ",
193
+ } ;
194
+
196
195
var gitInstaller = new GitInstaller ( Environment , ProcessManager , TaskManager . Token , installDetails : installDetails ) ;
197
196
198
197
var result = gitInstaller . SetupGitIfNeeded ( ) ;
199
198
result . Should ( ) . NotBeNull ( ) ;
200
199
201
- Assert . AreEqual ( gitInstallationPath . Combine ( GitInstaller . GitInstallDetails . GitDirectory ) , result . GitInstallationPath ) ;
202
- result . GitExecutablePath . Should ( ) . Be ( gitInstallationPath . Combine ( GitInstaller . GitInstallDetails . GitDirectory , "cmd" , "git" + Environment . ExecutableExtension ) ) ;
203
- result . GitLfsExecutablePath . Should ( ) . Be ( gitInstallationPath . Combine ( GitInstaller . GitInstallDetails . GitLfsDirectory , "git-lfs" + Environment . ExecutableExtension ) ) ;
200
+ Assert . AreEqual ( gitInstallationPath , result . GitInstallationPath ) ;
201
+ result . GitExecutablePath . Should ( ) . Be ( gitInstallationPath . Combine ( "cmd" , "git" + Environment . ExecutableExtension ) ) ;
202
+ result . GitLfsExecutablePath . Should ( ) . Be ( gitLfsInstallationPath . Combine ( "git-lfs" + Environment . ExecutableExtension ) ) ;
204
203
}
205
204
206
205
[ Test ]
207
206
public void GitLfsIsInstalledIfMissingWithCustomGitPath ( )
208
207
{
209
- var defaultGitInstall = TestBasePath . Combine ( "DefaultInstall" ) . CreateDirectory ( ) ;
210
- var customGitInstall = TestBasePath . Combine ( "CustomGitInstall" ) . CreateDirectory ( ) ;
211
-
212
- var installDetails = new GitInstaller . GitInstallDetails ( defaultGitInstall , DefaultEnvironment . OnWindows )
213
- {
214
- GitPackageFeed = $ "http://localhost:{ server . Port } /unity/git/windows/{ GitInstaller . GitInstallDetails . GitPackageName } ",
215
- GitLfsPackageFeed = $ "http://localhost:{ server . Port } /unity/git/windows/{ GitInstaller . GitInstallDetails . GitLfsPackageName } ",
216
- } ;
208
+ var tempZipExtractPath = TestBasePath . Combine ( "Temp" , "git_zip_extract_zip_paths" ) ;
209
+ var customGitInstall = TestBasePath . Combine ( "CustomGitInstall" ) . Combine ( GitInstaller . GitInstallDetails . GitDirectory ) ;
217
210
218
- var package = Package . Load ( Environment , installDetails . GitPackageFeed ) ;
211
+ var gitZipUri = new UriString ( $ "http://localhost: { server . Port } /unity/git/windows/git-slim.zip" ) ;
219
212
var downloader = new Downloader ( ) ;
220
- downloader . Catch ( e => true ) ;
221
- downloader . QueueDownload ( package . Uri , installDetails . ZipPath ) ;
213
+ downloader . QueueDownload ( gitZipUri , tempZipExtractPath ) ;
222
214
downloader . RunWithReturn ( true ) ;
223
215
224
- var tempZipExtractPath = TestBasePath . Combine ( "Temp" , "git_zip_extract_zip_paths" ) ;
225
-
226
216
var gitExtractPath = tempZipExtractPath . Combine ( "git" ) . CreateDirectory ( ) ;
227
- ZipHelper . Instance . Extract ( installDetails . GitZipPath , gitExtractPath , TaskManager . Token , null ) ;
217
+ ZipHelper . Instance . Extract ( tempZipExtractPath . Combine ( gitZipUri . Filename ) , gitExtractPath , TaskManager . Token , null ) ;
228
218
var source = gitExtractPath ;
229
219
var target = customGitInstall ;
230
220
target . DeleteIfExists ( ) ;
231
221
target . EnsureParentDirectoryExists ( ) ;
232
222
source . Move ( target ) ;
233
223
var gitExec = customGitInstall . Combine ( "cmd/git.exe" ) ;
224
+
234
225
var state = new GitInstaller . GitInstallationState ( ) ;
235
226
state . GitExecutablePath = gitExec ;
236
227
Environment . GitInstallationState = state ;
237
228
229
+ var defaultGitInstall = TestBasePath . Combine ( "DefaultInstall" ) ;
230
+
231
+ var installDetails = new GitInstaller . GitInstallDetails ( defaultGitInstall , DefaultEnvironment . OnWindows )
232
+ {
233
+ GitPackageFeed = "http://nope" ,
234
+ GitLfsPackageFeed = $ "http://localhost:{ server . Port } /unity/git/windows/{ GitInstaller . GitInstallDetails . GitLfsPackageName } ",
235
+ } ;
236
+
238
237
var gitInstaller = new GitInstaller ( Environment , ProcessManager , TaskManager . Token , installDetails : installDetails ) ;
239
238
240
239
state = gitInstaller . SetupGitIfNeeded ( ) ;
0 commit comments