Skip to content

Commit

Permalink
Use --no-cone in pipeline sparse checkout script (#3606)
Browse files Browse the repository at this point in the history
The latest update to git 2.37.0 adds cone and non-cone mode options [explanation](https://github.blog/2022-06-27-highlights-from-git-2-37/#tidbits). In code mode, our previously used sparse checkout pattern filtering does not work, as the command expects directories instead. This PR updates our sparse checkout command to set `--no-cone` for no cone mode.
  • Loading branch information
benbp authored Jul 11, 2022
1 parent 4d2d5fb commit 057fd2c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions eng/common/pipelines/templates/steps/sparse-checkout.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,10 @@ steps:
Write-Host "git sparse-checkout init"
git sparse-checkout init
Write-Host "git sparse-checkout set '/*' '!/*/' '/eng'"
git sparse-checkout set '/*' '!/*/' '/eng'
# Set non-cone mode otherwise path filters will not work in git >= 2.37.0
# See https://github.blog/2022-06-27-highlights-from-git-2-37/#tidbits
Write-Host "git sparse-checkout set --no-cone '/*' '!/*/' '/eng'"
git sparse-checkout set --no-cone '/*' '!/*/' '/eng'
}
# Prevent wildcard expansion in Invoke-Expression (e.g. for checkout path '/*')
Expand Down

0 comments on commit 057fd2c

Please sign in to comment.