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