Skip to content

Commit a3fe3d3

Browse files
azure-sdkbenbp
andauthored
Set multiple sparse checkout paths in one command/job (Azure#15052)
Co-authored-by: Ben Broderick Phillips <bebroder@microsoft.com>
1 parent 2e8aaad commit a3fe3d3

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

eng/common/pipelines/templates/steps/sparse-checkout.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,13 @@ steps:
2424
- pwsh: |
2525
git clone --no-checkout --filter=tree:0 git://github.com/${{ repo.Name }} .
2626
git sparse-checkout init
27-
git sparse-checkout set eng
27+
$paths = ('${{ convertToJson(parameters.Paths) }}' | ConvertFrom-Json) -Join ' '
28+
Invoke-Expression -Command "git sparse-checkout set eng $paths"
29+
Write-Host "Set sparse checkout paths to:"
30+
Get-Content .git/info/sparse-checkout
2831
displayName: Init sparse checkout ${{ repo.Name }}
2932
workingDirectory: ${{ coalesce(repo.WorkingDirectory, format('{0}/{1}', '$(System.DefaultWorkingDirectory)', repo.Name)) }}
3033
31-
- ${{ each path in parameters.Paths }}:
32-
- pwsh: git sparse-checkout add ${{ path }}
33-
displayName: Add sparse checkout path ${{ path }}
34-
workingDirectory: ${{ coalesce(repo.WorkingDirectory, format('{0}/{1}', '$(System.DefaultWorkingDirectory)', repo.Name)) }}
35-
3634
- pwsh: git checkout ${{ repo.Commitish }}
3735
displayName: Sparse checkout at ${{ repo.Commitish }}
3836
workingDirectory: ${{ coalesce(repo.WorkingDirectory, format('{0}/{1}', '$(System.DefaultWorkingDirectory)', repo.Name)) }}

0 commit comments

Comments
 (0)