Change Move-Item to Copy-Item
This commit is contained in:
parent
ccaaadf371
commit
90e1723052
|
@ -56,15 +56,7 @@ Get-Command Reload-MyScripts -ErrorAction SilentlyContinue | ForEach-Object { .
|
||||||
$local:GitOutput = "$(& git clone $GitURL $tmpGitDir.FullName --no-checkout)"
|
$local:GitOutput = "$(& git clone $GitURL $tmpGitDir.FullName --no-checkout)"
|
||||||
Write-Verbose $GitOutput
|
Write-Verbose $GitOutput
|
||||||
Write-Verbose "Moving git repo from temp location to $MyPSScriptRoot . . ."
|
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
|
Copy-Item -Recurse (Join-Path $tmpGitDir.FullName .git) ./.git
|
||||||
} else {
|
|
||||||
throw $_
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Remove-Item $tmpGitDir.FullName
|
Remove-Item $tmpGitDir.FullName
|
||||||
Write-Verbose "Checking out repo..."
|
Write-Verbose "Checking out repo..."
|
||||||
$GitOutput = "$(& git checkout --force)"
|
$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
|
Invoke-ExpressionEx -sudo:$shouldSudo chmod 'a+r' $tmpOutput.FullName
|
||||||
}
|
}
|
||||||
try {
|
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 ) {
|
if ( $errMsg ) {
|
||||||
Write-Error "$errMsg"
|
Write-Error "$errMsg"
|
||||||
$status = $status -replace 'Need ', 'Failed '
|
$status = $status -replace 'Need ', 'Failed '
|
||||||
|
|
Loading…
Reference in New Issue