Skip to content

Commit

Permalink
Set multiple sparse checkout paths in one command/job (#841)
Browse files Browse the repository at this point in the history
Co-authored-by: Ben Broderick Phillips <bebroder@microsoft.com>
  • Loading branch information
azure-sdk and benbp authored Apr 29, 2021
1 parent 1346788 commit f9063fb
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions eng/common/pipelines/templates/steps/sparse-checkout.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,13 @@ steps:
- pwsh: |
git clone --no-checkout --filter=tree:0 git://github.com/${{ repo.Name }} .
git sparse-checkout init
git sparse-checkout set eng
$paths = ('${{ convertToJson(parameters.Paths) }}' | ConvertFrom-Json) -Join ' '
Invoke-Expression -Command "git sparse-checkout set eng $paths"
Write-Host "Set sparse checkout paths to:"
Get-Content .git/info/sparse-checkout
displayName: Init sparse checkout ${{ repo.Name }}
workingDirectory: ${{ coalesce(repo.WorkingDirectory, format('{0}/{1}', '$(System.DefaultWorkingDirectory)', repo.Name)) }}
- ${{ each path in parameters.Paths }}:
- pwsh: git sparse-checkout add ${{ path }}
displayName: Add sparse checkout path ${{ path }}
workingDirectory: ${{ coalesce(repo.WorkingDirectory, format('{0}/{1}', '$(System.DefaultWorkingDirectory)', repo.Name)) }}

- pwsh: git checkout ${{ repo.Commitish }}
displayName: Sparse checkout at ${{ repo.Commitish }}
workingDirectory: ${{ coalesce(repo.WorkingDirectory, format('{0}/{1}', '$(System.DefaultWorkingDirectory)', repo.Name)) }}

0 comments on commit f9063fb

Please sign in to comment.