Browse Source

Fixed cross linked device failing move of .git dir

master
lksz 1 year ago
parent
commit
fe97c2880a
1 changed files with 9 additions and 1 deletions
  1. +9
    -1
      Setup-Profile.ps1

+ 9
- 1
Setup-Profile.ps1 View File

@@ -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…
Cancel
Save