Skip to content

Commit de859a7

Browse files
committed
ci: use git-sdk-64-minimal
This is a (partial) backport of the improvements of the Azure Pipeline made in Git for Windows v2.21.0. The major benefit is that it makes the task to initialize the Git for Windows SDK *a lot* faster. It would also have worked around a problem where an MSYS2 update breaks t6500.13, and it will work around similar problems in the future, as the Azure Pipeline that updates git-sdk-64-minimal will not publish a new artifact unless Git's test suite (as of upstream's current `master`) passes.
1 parent 469f915 commit de859a7

File tree

1 file changed

+11
-41
lines changed

1 file changed

+11
-41
lines changed

azure-pipelines.yml

Lines changed: 11 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -175,53 +175,23 @@ phases:
175175
env:
176176
GITFILESHAREPWD: $(gitfileshare.pwd)
177177
- powershell: |
178-
# Helper to check the error level of the latest command (exit with error when appropriate)
179-
function c() { if (!$?) { exit(1) } }
180-
181-
# Add build agent's MinGit to PATH
182-
$env:PATH = $env:AGENT_HOMEDIRECTORY +"\externals\\git\cmd;" +$env:PATH
183-
184-
# Helper to initialize (or update) a Git worktree
185-
function init ($path, $url, $set_origin) {
186-
if (Test-Path $path) {
187-
cd $path; c
188-
if (Test-Path .git) {
189-
git init; c
190-
} else {
191-
git status
192-
}
193-
} else {
194-
git init $path; c
195-
cd $path; c
196-
}
197-
git config core.autocrlf false; c
198-
git config core.untrackedCache true; c
199-
if (($set_origin -ne 0) -and !(git config remote.origin.url)) {
200-
git remote add origin $url; c
201-
}
202-
git fetch --depth=1 $url master; c
203-
git reset --hard FETCH_HEAD; c
204-
git clean -df; c
205-
}
206-
207-
# Initialize Git for Windows' SDK
208-
$sdk_path = "$(Build.SourcesDirectory)\git-sdk-64"
209-
init "$sdk_path" "https://dev.azure.com/git-for-windows/git-sdk-64/_git/git-sdk-64" 0
210-
init usr\src\build-extra https://github.com/git-for-windows/build-extra 1
211-
212-
# Let Git ignore the SDK and the test-cache
213-
"/git-sdk-64/`n/test-cache/`n" | Out-File -NoNewLine -Encoding ascii -Append "$(Build.SourcesDirectory)\.git\info\exclude"
214-
215-
# Help MSYS2 runtime startup by initializing /etc/passwd
216-
& "$sdk_path\git-cmd" --command=usr\\bin\\bash.exe -lc "mkpasswd -c >>/etc/passwd"; c
217-
displayName: 'Initialize the Git for Windows SDK'
178+
$urlbase = "https://dev.azure.com/git-for-windows/git/_apis/build/builds"
179+
$id = ((Invoke-WebRequest -UseBasicParsing "${urlbase}?definitions=22&statusFilter=completed&resultFilter=succeeded&`$top=1").content | ConvertFrom-JSON).value[0].id
180+
$downloadUrl = ((Invoke-WebRequest -UseBasicParsing "${urlbase}/$id/artifacts").content | ConvertFrom-JSON).value[1].resource.downloadUrl
181+
(New-Object Net.WebClient).DownloadFile($downloadUrl,"git-sdk-64-minimal.zip")
182+
Expand-Archive git-sdk-64-minimal.zip -DestinationPath "$(Build.SourcesDirectory)" -Force
183+
Remove-Item git-sdk-64-minimal.zip
184+
185+
# Let Git ignore the SDK and the test-cache
186+
"/git-sdk-64-minimal/`n/test-cache/`n" | Out-File -NoNewLine -Encoding ascii -Append "$(Build.SourcesDirectory)\.git\info\exclude"
187+
displayName: 'Download git-sdk-64-minimal'
218188
- powershell: |
219189
# Helper to check the error level of the latest command (exit with error when appropriate)
220190
function c() { if (!$?) { exit(1) } }
221191
222192
cd "$(Build.SourcesDirectory)"; c
223193
224-
git-sdk-64\git-cmd --command=usr\\bin\\bash.exe -lc @"
194+
& git-sdk-64-minimal\usr\bin\bash.exe -lc @"
225195
export MAKEFLAGS=-j10
226196
export DEVELOPER=1
227197
export NO_PERL=1

0 commit comments

Comments
 (0)