mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-08-10 05:17:44 +02:00
Add shallow cloning to clone-repos.ps1
This commit is contained in:
@ -15,21 +15,27 @@ try {
|
||||
$Null = (git --version)
|
||||
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
|
||||
|
||||
$Table = import-csv "$PSScriptRoot/../Data/git-repositories.csv"
|
||||
$Table = import-csv "$PSScriptRoot/../Data/git-repos.csv"
|
||||
|
||||
[int]$Count = 0
|
||||
foreach($Row in $Table) {
|
||||
$AppName = $Row.AppName
|
||||
$FolderName = $Row.FolderName
|
||||
$BranchName = $Row.BranchName
|
||||
$URL = $Row.URL
|
||||
[string]$AppName = $Row.AppName
|
||||
[string]$FolderName = $Row.FolderName
|
||||
[string]$Branch = $Row.Branch
|
||||
[string]$Shallow = $Row.Shallow
|
||||
[string]$URL = $Row.URL
|
||||
|
||||
if (test-path "$ParentDir/$FolderName" -pathType container) {
|
||||
"📂$FolderName exists, skipping..."
|
||||
continue
|
||||
}
|
||||
"🢃 Cloning $AppName into 📂$FolderName, $BranchName branch..."
|
||||
& git clone --branch "$BranchName" --recurse-submodules "$URL" "$ParentDir/$FolderName"
|
||||
if ($Shallow -eq "yes") {
|
||||
"🢃 Cloning $AppName into 📂$FolderName, $Branch branch, shallow..."
|
||||
& git clone --branch "$Branch" --depth 1 --shallow-submodules --recurse-submodules "$URL" "$ParentDir/$FolderName"
|
||||
} else {
|
||||
"🢃 Cloning $AppName into 📂$FolderName, $Branch branch, full history..."
|
||||
& git clone --branch "$Branch" --recurse-submodules "$URL" "$ParentDir/$FolderName"
|
||||
}
|
||||
if ($lastExitCode -ne "0") { throw "'git clone $URL' failed" }
|
||||
$Count++
|
||||
}
|
||||
|
Reference in New Issue
Block a user