Improve clone-repos.ps1

This commit is contained in:
Markus Fleschutz
2021-05-26 19:47:00 +02:00
parent 6e031bf3ba
commit fc97a6054b
2 changed files with 27 additions and 26 deletions

View File

@ -19,14 +19,15 @@ try {
[int]$Count = 0
foreach($Row in $Table) {
$Directory = $Row.Directory
$Branch = $Row.Branch
$URL = $Row.URL
$DirName = $Row.Directory
if (test-path "$ParentDir/$DirName" -pathType container) {
"📂$DirName exists already, skipping..."
if (test-path "$ParentDir/$Directory" -pathType container) {
"📂$Directory exists already, skipping..."
continue
}
" Cloning 📂$DirName from $URL..."
& git clone --recurse-submodules "$URL" "$ParentDir/$DirName"
"🢃 Cloning 📂$Directory from $URL, $Branch branch..."
& git clone --branch "$Branch" --recurse-submodules "$URL" "$ParentDir/$Directory"
if ($lastExitCode -ne "0") { throw "'git clone $URL' failed" }
$Count++
}