From 057fd2cbb7f68b3785f689533ac3a5d33585dfa1 Mon Sep 17 00:00:00 2001 From: Ben Broderick Phillips Date: Mon, 11 Jul 2022 13:44:03 -0400 Subject: [PATCH] Use --no-cone in pipeline sparse checkout script (#3606) 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. --- eng/common/pipelines/templates/steps/sparse-checkout.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/eng/common/pipelines/templates/steps/sparse-checkout.yml b/eng/common/pipelines/templates/steps/sparse-checkout.yml index 49f9eb553b0..a3b553b3a7a 100644 --- a/eng/common/pipelines/templates/steps/sparse-checkout.yml +++ b/eng/common/pipelines/templates/steps/sparse-checkout.yml @@ -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 '/*')