bugfix: logic error: pull only if in git repository

This commit is contained in:
Baipyrus 2024-11-28 15:07:31 +01:00
parent 0e50978a74
commit 4ab07fb4db

View File

@ -40,15 +40,15 @@ function ReadyDotfilesRepo
} }
# Clone new repo in destination dir if not exists # Clone new repo in destination dir if not exists
if (-not (Test-Path $destination)) if ((Test-Path $destination) -and (IsGitRepository -dir $destination -url $url))
{ {
Write-Host "Cloning dotfiles repository..." -ForegroundColor Cyan Write-Host "Pulling latest changes from dotfiles repository..." -ForegroundColor Cyan
git clone $url $destination Write-Host "$(git -C $destination pull)"
return $destination return $destination
} }
Write-Host "Pulling latest changes from dotfiles repository..." -ForegroundColor Cyan Write-Host "Cloning dotfiles repository..." -ForegroundColor Cyan
Write-Host "$(git -C $destination pull)" git clone $url $destination
return $destination return $destination
} }