Improve clone-repos.ps1

This commit is contained in:
Markus Fleschutz
2021-06-28 20:58:37 +02:00
parent 63e8cc3d42
commit 8cd8bfc1cd
2 changed files with 29 additions and 27 deletions

View File

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