Private/Copy-GitRepo.ps1
function Copy-GitRepo { [CmdletBinding()] param( [String] $Template, [String] $Name, [String] $LoggingPrefix ) try { Write-EdenInfo "Cloning a new Eden service '$Name' based on the '$Template' template." $LoggingPrefix git clone $Template $Name Write-EdenInfo "Removing the .git folder." $LoggingPrefix $hasDeleted = $false Start-Sleep 2 while (!$hasDeleted) { try { Remove-Item "./$Name/.git/*" -Recurse -Force -ErrorAction Stop $hasDeleted = $true } catch { Write-EdenInfo "Error trying to remove the .git folder: $($_.Exception.Message)" $LoggingPrefix Write-EdenInfo "Retrying in 2 seconds..." $LoggingPrefix Start-Sleep 2 } } Remove-Item "./$Name/.git" -Recurse -Force } catch { Write-EdenError "Error cloning a new Eden service '$Name' based on the '$Template' template." $LoggingPrefix throw $_ } } |