From b2d2c4d93cd726f1ddf38dc75f63e2d85949118e Mon Sep 17 00:00:00 2001 From: Daniel Jurek Date: Mon, 5 Feb 2024 20:24:40 -0800 Subject: [PATCH] Fix sparse-checkout git command line behavior (#7634) * Fix sparse-checkout git command line behavior * Use command arg parsing behavior in sparse-checkout.yml --- eng/common/pipelines/templates/steps/sparse-checkout.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/eng/common/pipelines/templates/steps/sparse-checkout.yml b/eng/common/pipelines/templates/steps/sparse-checkout.yml index 1f5e3fc375f..24f4f547476 100644 --- a/eng/common/pipelines/templates/steps/sparse-checkout.yml +++ b/eng/common/pipelines/templates/steps/sparse-checkout.yml @@ -26,6 +26,11 @@ steps: # Define this inline, because of the chicken/egg problem with loading a script when nothing # has been checked out yet. script: | + # Setting $PSNativeCommandArgumentPassing to 'Legacy' to use PowerShell + # 7.2 behavior for command argument passing. Newer behaviors will result + # in errors from git.exe. + $PSNativeCommandArgumentPassing = 'Legacy' + function SparseCheckout([Array]$paths, [Hashtable]$repository) { $dir = $repository.WorkingDirectory