Skip to content

Commit fa1eca4

Browse files
danieljurekazure-sdk
authored andcommitted
Use command arg parsing behavior in sparse-checkout.yml
1 parent 9b88b0d commit fa1eca4

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

eng/common/pipelines/templates/steps/sparse-checkout.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ steps:
2626
# Define this inline, because of the chicken/egg problem with loading a script when nothing
2727
# has been checked out yet.
2828
script: |
29+
# Setting $PSNativeCommandArgumentPassing to 'Legacy' to use PowerShell
30+
# 7.2 behavior for command argument passing. Newer behaviors will result
31+
# in errors from git.exe.
32+
$PSNativeCommandArgumentPassing = 'Legacy'
33+
2934
function SparseCheckout([Array]$paths, [Hashtable]$repository)
3035
{
3136
$dir = $repository.WorkingDirectory
@@ -80,7 +85,7 @@ steps:
8085
Write-Host "git -c advice.detachedHead=false checkout $commitish --"
8186
8287
# This will use the default branch if repo.Commitish is empty
83-
Invoke-Expression -Command "git -c advice.detachedHead=false checkout $commitish --"
88+
git -c advice.detachedHead=false checkout $commitish --
8489
} else {
8590
Write-Host "Skipping checkout as repo has already been initialized"
8691
}

0 commit comments

Comments
 (0)