Change Move-Item to Copy-Item

This commit is contained in:
lksz 2020-10-02 15:49:24 -04:00
부모 ccaaadf371
커밋 90e1723052
1개의 변경된 파일2개의 추가작업 그리고 10개의 파일을 삭제

파일 보기

@ -56,15 +56,7 @@ Get-Command Reload-MyScripts -ErrorAction SilentlyContinue | ForEach-Object { .
$local:GitOutput = "$(& git clone $GitURL $tmpGitDir.FullName --no-checkout)"
Write-Verbose $GitOutput
Write-Verbose "Moving git repo from temp location to $MyPSScriptRoot . . ."
try {
Move-Item (Join-Path $tmpGitDir.FullName .git) ./.git -ErrorAction Stop
} catch {
if( $_.Exception.Message -eq "Invalid cross-device link" ) {
Copy-Item -Recurse (Join-Path $tmpGitDir.FullName .git) ./.git
} else {
throw $_
}
}
Copy-Item -Recurse (Join-Path $tmpGitDir.FullName .git) ./.git
Remove-Item $tmpGitDir.FullName
Write-Verbose "Checking out repo..."
$GitOutput = "$(& git checkout --force)"
@ -177,7 +169,7 @@ Get-Command Reload-MyScripts -ErrorAction SilentlyContinue | ForEach-Object { .
Invoke-ExpressionEx -sudo:$shouldSudo chmod 'a+r' $tmpOutput.FullName
}
try {
$local:errMsg = $(Invoke-ExpressionEx -sudo:$shouldSudo "Move-Item $($tmpOutput.FullName) $p -Force:`$$Force -ErrorAction Stop | Out-Null" 2>&1)
$local:errMsg = $(Invoke-ExpressionEx -sudo:$shouldSudo "Copy-Item $($tmpOutput.FullName) $p -Force:`$$Force -ErrorAction Stop | Out-Null; Remove-Item $($tmpOutput.FullName) -Force:`$$Force -ErrorAction Stop" 2>&1)
if ( $errMsg ) {
Write-Error "$errMsg"
$status = $status -replace 'Need ', 'Failed '