Skip to content

Commit

Permalink
Use command arg parsing behavior in sparse-checkout.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
danieljurek authored and azure-sdk committed Feb 5, 2024
1 parent 2e8b909 commit 795eb23
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion eng/common/pipelines/templates/steps/sparse-checkout.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -80,7 +85,7 @@ steps:
Write-Host "git -c advice.detachedHead=false checkout $commitish --"
# This will use the default branch if repo.Commitish is empty
Invoke-Expression -Command "git -c advice.detachedHead=false checkout $commitish --"
git -c advice.detachedHead=false checkout $commitish --
} else {
Write-Host "Skipping checkout as repo has already been initialized"
}
Expand Down

0 comments on commit 795eb23

Please sign in to comment.