Update clone-repos.ps1

This commit is contained in:
Markus Fleschutz
2022-04-27 15:29:06 +02:00
parent 151c5f73c0
commit 0c4d8c927d
2 changed files with 35 additions and 35 deletions

View File

@ -35,7 +35,7 @@ try {
foreach($Row in $Table) {
[string]$FolderName = $Row.FolderName
[string]$Branch = $Row.Branch
[string]$Shallow = $Row.Shallow
[string]$Full = $Row.Full
[string]$URL = $Row.URL
$Step++
@ -44,14 +44,14 @@ try {
$Skipped++
continue
}
if ($Shallow -eq "yes") {
"⏳ Step $Step/$($NumEntries): Cloning 📂$($FolderName) (shallow '$Branch' branch)..."
& git clone --branch "$Branch" --depth 1 --shallow-submodules --recurse-submodules "$URL" "$FolderPath/$FolderName"
if ($lastExitCode -ne "0") { throw "'git clone $URL' failed" }
} else {
"⏳ Step $Step/$($NumEntries): Cloning 📂$FolderName (full '$Branch' branch)..."
if ($Full -eq "yes") {
"⏳ Step $Step/$($NumEntries): Cloning 📂$($FolderName) ($Branch branch with full history)..."
& git clone --branch "$Branch" --recurse-submodules "$URL" "$FolderPath/$FolderName"
if ($lastExitCode -ne "0") { throw "'git clone $URL' failed" }
if ($lastExitCode -ne "0") { throw "'git clone --branch $Branch $URL' failed with exit code $lastExitCode" }
} else {
"⏳ Step $Step/$($NumEntries): Cloning 📂$FolderName ($Branch branch only)..."
& git clone --branch "$Branch" --single-branch --recurse-submodules "$URL" "$FolderPath/$FolderName"
if ($lastExitCode -ne "0") { throw "'git clone --branch $Branch $URL' failed with exit code $lastExitCode" }
}
$Cloned++
}