From fe97c2880a5b76df443cd2eb4dde1c64020d0a88 Mon Sep 17 00:00:00 2001 From: lksz Date: Fri, 2 Oct 2020 14:23:54 -0400 Subject: [PATCH] Fixed cross linked device failing move of .git dir --- Setup-Profile.ps1 | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Setup-Profile.ps1 b/Setup-Profile.ps1 index 7a24ab8..46363f1 100644 --- a/Setup-Profile.ps1 +++ b/Setup-Profile.ps1 @@ -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)"