Prevent wildcard expansion in git sparse checkout add (#2745)
Co-authored-by: Ben Broderick Phillips <bebroder@microsoft.com>
This commit is contained in:
parent
8d0e4dfd1c
commit
b62de00276
@ -25,8 +25,6 @@ steps:
|
||||
script: |
|
||||
function SparseCheckout([Array]$paths, [Hashtable]$repository)
|
||||
{
|
||||
$paths = $paths -Join ' '
|
||||
|
||||
$dir = $repository.WorkingDirectory
|
||||
if (!$dir) {
|
||||
$dir = "./$($repository.Name)"
|
||||
@ -50,7 +48,9 @@ steps:
|
||||
git sparse-checkout set '/*' '!/*/' '/eng'
|
||||
}
|
||||
|
||||
$gitsparsecmd = "git sparse-checkout add $paths"
|
||||
# Prevent wildcard expansion in Invoke-Expression (e.g. for checkout path '/*')
|
||||
$quotedPaths = $paths | ForEach-Object { "'$_'" }
|
||||
$gitsparsecmd = "git sparse-checkout add $quotedPaths"
|
||||
Write-Host $gitsparsecmd
|
||||
Invoke-Expression -Command $gitsparsecmd
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user