mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-11-25 09:23:12 +01:00
Add shallow cloning to clone-repos.ps1
This commit is contained in:
parent
7509212f69
commit
e0acb18f6d
22
Data/git-repos.csv
Normal file
22
Data/git-repos.csv
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
AppName,FolderName,Branch,Shallow,URL
|
||||||
|
B256U, base256unicode, master, no, "https://github.com/fleschutz/base256unicode"
|
||||||
|
Bazel, bazel, master, yes, "https://github.com/bazelbuild/bazel"
|
||||||
|
CMake, cmake, master, yes, "https://github.com/Kitware/CMake"
|
||||||
|
CMatrix, cmatrix, master, yes, "https://github.com/abishekvashok/cmatrix"
|
||||||
|
CMark, cmark, master, yes, "https://github.com/commonmark/cmark"
|
||||||
|
CWTS, CWTS, master, no, "https://github.com/fleschutz/CWTS"
|
||||||
|
ElasticSearch, elasticsearch, master, yes, "https://github.com/elastic/elasticsearch"
|
||||||
|
Grafana, grafana, main, yes, "https://github.com/grafana/grafana"
|
||||||
|
LLVM, llvm, master, yes, "https://github.com/llvm/llvm-project"
|
||||||
|
Ninja, ninja, master, yes, "git://github.com/ninja-build/ninja.git"
|
||||||
|
OpenCV, opencv, master, yes, "https://github.com/opencv/opencv"
|
||||||
|
OSMA, OSMA, master, no, "https://github.com/fleschutz/OSMA"
|
||||||
|
PowerShell, PowerShell, master, no, "https://github.com/fleschutz/PowerShell"
|
||||||
|
LSS, LSS, master, yes, "https://github.com/fleschutz/LSS"
|
||||||
|
ProtoBuf, protobuf, master, yes, "https://github.com/protocolbuffers/protobuf"
|
||||||
|
SmartMonTools, smartmontools, master, yes, "https://github.com/smartmontools/smartmontools"
|
||||||
|
Tensorflow, tensorflow, master, yes, "https://github.com/tensorflow/tensorflow"
|
||||||
|
Windows Terminal,terminal, main, yes, "https://github.com/microsoft/terminal"
|
||||||
|
TinyCC, tinycc, mob, yes, "https://github.com/TinyCC/tinycc"
|
||||||
|
Voice2Json, voice2json, master, yes, "https://github.com/synesthesiam/voice2json"
|
||||||
|
ZFS, zfs, master, yes, "https://github.com/openzfs/zfs"
|
Can't render this file because it has a wrong number of fields in line 2.
|
@ -1,22 +0,0 @@
|
|||||||
AppName,FolderName,BranchName,URL
|
|
||||||
B256U, base256unicode, master, "https://github.com/fleschutz/base256unicode"
|
|
||||||
Bazel, bazel, master, "https://github.com/bazelbuild/bazel"
|
|
||||||
CMake, cmake, master, "https://github.com/Kitware/CMake"
|
|
||||||
CMatrix, cmatrix, master, "https://github.com/abishekvashok/cmatrix"
|
|
||||||
CMark, cmark, master, "https://github.com/commonmark/cmark"
|
|
||||||
CWTS, CWTS, master, "https://github.com/fleschutz/CWTS"
|
|
||||||
ElasticSearch, elasticsearch, master, "https://github.com/elastic/elasticsearch"
|
|
||||||
Grafana, grafana, master, "https://github.com/grafana/grafana"
|
|
||||||
LLVM, llvm, master, "https://github.com/llvm/llvm-project"
|
|
||||||
Ninja, ninja, master, "git://github.com/ninja-build/ninja.git"
|
|
||||||
OpenCV, opencv, master, "https://github.com/opencv/opencv"
|
|
||||||
OSMA, OSMA, master, "https://github.com/fleschutz/OSMA"
|
|
||||||
PowerShell, PowerShell, master, "https://github.com/fleschutz/PowerShell"
|
|
||||||
LSS, LSS, master, "https://github.com/fleschutz/LSS"
|
|
||||||
ProtoBuf, protobuf, master, "https://github.com/protocolbuffers/protobuf"
|
|
||||||
SmartMonTools, smartmontools, master, "https://github.com/smartmontools/smartmontools"
|
|
||||||
Tensorflow, tensorflow, master, "https://github.com/tensorflow/tensorflow"
|
|
||||||
Windows Terminal,terminal, main, "https://github.com/microsoft/terminal"
|
|
||||||
TinyCC, tinycc, master, "https://github.com/TinyCC/tinycc"
|
|
||||||
Voice2Json, voice2json, master, "https://github.com/synesthesiam/voice2json"
|
|
||||||
ZFS, zfs, master, "https://github.com/openzfs/zfs"
|
|
Can't render this file because it has a wrong number of fields in line 2.
|
@ -15,21 +15,27 @@ try {
|
|||||||
$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" }
|
||||||
|
|
||||||
$Table = import-csv "$PSScriptRoot/../Data/git-repositories.csv"
|
$Table = import-csv "$PSScriptRoot/../Data/git-repos.csv"
|
||||||
|
|
||||||
[int]$Count = 0
|
[int]$Count = 0
|
||||||
foreach($Row in $Table) {
|
foreach($Row in $Table) {
|
||||||
$AppName = $Row.AppName
|
[string]$AppName = $Row.AppName
|
||||||
$FolderName = $Row.FolderName
|
[string]$FolderName = $Row.FolderName
|
||||||
$BranchName = $Row.BranchName
|
[string]$Branch = $Row.Branch
|
||||||
$URL = $Row.URL
|
[string]$Shallow = $Row.Shallow
|
||||||
|
[string]$URL = $Row.URL
|
||||||
|
|
||||||
if (test-path "$ParentDir/$FolderName" -pathType container) {
|
if (test-path "$ParentDir/$FolderName" -pathType container) {
|
||||||
"📂$FolderName exists, skipping..."
|
"📂$FolderName exists, skipping..."
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
"🢃 Cloning $AppName into 📂$FolderName, $BranchName branch..."
|
if ($Shallow -eq "yes") {
|
||||||
& git clone --branch "$BranchName" --recurse-submodules "$URL" "$ParentDir/$FolderName"
|
"🢃 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" }
|
if ($lastExitCode -ne "0") { throw "'git clone $URL' failed" }
|
||||||
$Count++
|
$Count++
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user