Fixed cross linked device failing move of .git dir
This commit is contained in:
parent
e14f00d98d
commit
fe97c2880a
|
@ -55,7 +55,15 @@ 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 . . ."
|
||||
Move-Item (Join-Path $tmpGitDir.FullName .git) ./.git
|
||||
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 $_
|
||||
}
|
||||
}
|
||||
Remove-Item $tmpGitDir.FullName
|
||||
Write-Verbose "Checking out repo..."
|
||||
$GitOutput = "$(& git checkout --force)"
|
||||
|
|
Loading…
Reference in New Issue