18
env:
19
GITFILESHAREPWD: $(gitfileshare.pwd)
20
- powershell: |
21
- # Helper to check the error level of the latest command (exit with error when appropriate)
22
- function c() { if (!$?) { exit(1) } }
23
-
24
- # Add build agent's MinGit to PATH
25
- $env:PATH = $env:AGENT_HOMEDIRECTORY +"\externals\\git\cmd;" +$env:PATH
26
-
27
- # Helper to initialize (or update) a Git worktree
28
- function init ($path, $url, $set_origin) {
29
- if (Test-Path $path) {
30
- cd $path; c
31
- if (Test-Path .git) {
32
- & git init; c
33
- } else {
34
- & git status
35
- }
36
- } else {
37
- & git init $path; c
38
- cd $path; c
39
- }
40
- & git config core.autocrlf false; c
41
- & git config core.untrackedCache true; c
42
- if (($set_origin -ne 0) -and !(git config remote.origin.url)) {
43
- & git remote add origin $url; c
44
- }
45
- & git fetch --depth=1 $url master; c
46
- & git reset --hard FETCH_HEAD; c
47
- & git clean -df; c
48
- }
49
-
50
- # Initialize Git for Windows' SDK
51
- $sdk_path = "$(Build.SourcesDirectory)\git-sdk-64"
52
- init "$sdk_path" "https://dev.azure.com/git-for-windows/git-sdk-64/_git/git-sdk-64" 0
21
+ $urlbase = "https://dev.azure.com/git-for-windows/git/_apis/build/builds"
22
+ $id = ((Invoke-WebRequest -UseBasicParsing "${urlbase}?definitions=22&statusFilter=completed&resultFilter=succeeded&`$top=1").content | ConvertFrom-JSON).value[0].id
23
+ $downloadUrl = ((Invoke-WebRequest -UseBasicParsing "${urlbase}/$id/artifacts").content | ConvertFrom-JSON).value[1].resource.downloadUrl
24
+ (New-Object Net.WebClient).DownloadFile($downloadUrl,"git-sdk-64-minimal.zip")
25
+ Expand-Archive git-sdk-64-minimal.zip -DestinationPath . -Force
26
+ Remove-Item git-sdk-64-minimal.zip
27
28
# Let Git ignore the SDK and the test-cache
55
- "/git-sdk-64/`n/test-cache/`n" | Out-File -NoNewLine -Encoding ascii -Append "$(Build.SourcesDirectory)\.git\info\exclude"
56
- displayName: 'Initialize the Git for Windows SDK'
29
+ "/git-sdk-64-minimal/`n/test-cache/`n" | Out-File -NoNewLine -Encoding ascii -Append "$(Build.SourcesDirectory)\.git\info\exclude"
30
+ displayName: 'Download git-sdk-64-minimal'
31
- powershell: |
58
- & "git-sdk-64\git-cmd.exe" --command=usr\\bin\\bash.exe -lc @"
32
+ & git-sdk-64-minimal\usr\bin\bash.exe -lc @"
33
export DEVELOPER=1
34
export NO_PERL=1
35
export NO_SVN_TESTS=1