Improve clone-repos.ps1

This commit is contained in:
Markus 2021-04-19 19:39:52 +02:00
parent f8eaf73614
commit bb5e5d4b82
2 changed files with 6 additions and 5 deletions

View File

@ -6,6 +6,7 @@ URL,Directory
"https://github.com/fleschutz/LSS", "LSS"
"https://github.com/fleschutz/base256unicode", "base256unicode"
"https://github.com/grafana/grafana", "grafana"
"https://github.com/llvm/llvm-project", "llvm"
"https://github.com/smartmontools/smartmontools", "smartmontools"
"https://github.com/synesthesiam/voice2json", "voice2json"
"https://github.com/TinyCC/tinycc", "tinycc"
1 URL Directory
6 https://github.com/fleschutz/LSS LSS
7 https://github.com/fleschutz/base256unicode base256unicode
8 https://github.com/grafana/grafana grafana
9 https://github.com/llvm/llvm-project llvm
10 https://github.com/smartmontools/smartmontools smartmontools
11 https://github.com/synesthesiam/voice2json voice2json
12 https://github.com/TinyCC/tinycc tinycc

View File

@ -9,22 +9,22 @@
param($TargetDir = "$PWD")
try {
if (-not(test-path "$TargetDir" -pathType container)) { throw "Can't access directory: $TargetDir" }
$Null = (git --version)
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
$PathToRepo = "$PSScriptRoot/.."
$Table = import-csv "$PathToRepo/Data/repos.csv"
$Table = import-csv "$PSScriptRoot/../Data/git-repositories.csv"
set-location $TargetDir
foreach($Row in $Table) {
$URL = $Row.URL
$Directory = $Row.Directory
if (Test-Path $Directory) {
if (Test-Path "$TargetDir/$Directory") {
"Skipping existing $Directory..."
continue
}
"⏳ Cloning $URL..."
& git clone --recurse-submodules $URL
& git clone --recurse-submodules "$URL" "$TargetDir/$Directory"
if ($lastExitCode -ne "0") { throw "'git clone $URL' failed" }
""
}