mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-04-25 11:28:17 +02:00
Update clone-repos.ps1
This commit is contained in:
parent
8149c001b7
commit
470cfcbb2f
@ -19,7 +19,7 @@ try {
|
|||||||
$StopWatch = [system.diagnostics.stopwatch]::startNew()
|
$StopWatch = [system.diagnostics.stopwatch]::startNew()
|
||||||
|
|
||||||
if (-not(test-path "$FolderPath" -pathType container)) { throw "Can't access directory: $FolderPath" }
|
if (-not(test-path "$FolderPath" -pathType container)) { throw "Can't access directory: $FolderPath" }
|
||||||
$ParentFolderName = (get-item "$FolderPath").Name
|
$ParentFolderName = (Get-Item "$FolderPath").Name
|
||||||
|
|
||||||
$Null = (git --version)
|
$Null = (git --version)
|
||||||
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
|
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
|
||||||
@ -39,18 +39,19 @@ try {
|
|||||||
$Step++
|
$Step++
|
||||||
|
|
||||||
if (test-path "$FolderPath/$FolderName" -pathType container) {
|
if (test-path "$FolderPath/$FolderName" -pathType container) {
|
||||||
"⏳ Step $Step/$($NumEntries): skipping already existing 📂$($FolderName)..."
|
"⏳ Step $Step/$($NumEntries): Skipping already existing 📂$($FolderName)..."
|
||||||
$Skipped++
|
$Skipped++
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if ($Shallow -eq "yes") {
|
if ($Shallow -eq "yes") {
|
||||||
"⏳ Step $Step/$($NumEntries): cloning shallow $Branch branch to 📂$($FolderName)..."
|
"⏳ Step $Step/$($NumEntries): Cloning shallow $Branch branch to 📂$($FolderName)..."
|
||||||
& git clone --branch "$Branch" --depth 1 --shallow-submodules --recurse-submodules "$URL" "$FolderPath/$FolderName"
|
& git clone --branch "$Branch" --depth 1 --shallow-submodules --recurse-submodules "$URL" "$FolderPath/$FolderName"
|
||||||
|
if ($lastExitCode -ne "0") { throw "'git clone $URL' failed" }
|
||||||
} else {
|
} else {
|
||||||
"⏳ Step $Step/$($NumEntries): cloning full $Branch branch to 📂$FolderName..."
|
"⏳ Step $Step/$($NumEntries): Cloning full $Branch branch to 📂$FolderName..."
|
||||||
& git clone --branch "$Branch" --recurse-submodules "$URL" "$FolderPath/$FolderName"
|
& 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 $URL' failed" }
|
|
||||||
$Cloned++
|
$Cloned++
|
||||||
}
|
}
|
||||||
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
|
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
|
||||||
|
Loading…
Reference in New Issue
Block a user