From fc97a6054b703528021692fed5899af25363d176 Mon Sep 17 00:00:00 2001 From: Markus Fleschutz Date: Wed, 26 May 2021 19:47:00 +0200 Subject: [PATCH] Improve clone-repos.ps1 --- Data/git-repositories.csv | 42 +++++++++++++++++++-------------------- Scripts/clone-repos.ps1 | 11 +++++----- 2 files changed, 27 insertions(+), 26 deletions(-) diff --git a/Data/git-repositories.csv b/Data/git-repositories.csv index abf7d066..9006b402 100644 --- a/Data/git-repositories.csv +++ b/Data/git-repositories.csv @@ -1,21 +1,21 @@ -Directory,URL -"base256unicode", "https://github.com/fleschutz/base256unicode" -"bazel", "https://github.com/bazelbuild/bazel" -"cmake", "https://github.com/Kitware/CMake" -"cmatrix", "https://github.com/abishekvashok/cmatrix" -"cmark", "https://github.com/commonmark/cmark" -"CWTS", "https://github.com/fleschutz/CWTS" -"elasticsearch", "https://github.com/elastic/elasticsearch" -"grafana", "https://github.com/grafana/grafana" -"llvm", "https://github.com/llvm/llvm-project" -"ninja", "git://github.com/ninja-build/ninja.git" -"opencv", "https://github.com/opencv/opencv" -"OSMA", "https://github.com/fleschutz/OSMA" -"PowerShell", "https://github.com/fleschutz/PowerShell" -"LSS", "https://github.com/fleschutz/LSS" -"protobuf", "https://github.com/protocolbuffers/protobuf" -"smartmontools", "https://github.com/smartmontools/smartmontools" -"tensorflow", "https://github.com/tensorflow/tensorflow" -"tinycc", "https://github.com/TinyCC/tinycc" -"voice2json", "https://github.com/synesthesiam/voice2json" -"zfs", "https://github.com/openzfs/zfs" +Directory,Branch,URL +base256unicode, master, "https://github.com/fleschutz/base256unicode" +bazel, master, "https://github.com/bazelbuild/bazel" +cmake, master, "https://github.com/Kitware/CMake" +cmatrix, master, "https://github.com/abishekvashok/cmatrix" +cmark, master, "https://github.com/commonmark/cmark" +CWTS, master, "https://github.com/fleschutz/CWTS" +elasticsearch, master, "https://github.com/elastic/elasticsearch" +grafana, master, "https://github.com/grafana/grafana" +llvm, master, "https://github.com/llvm/llvm-project" +ninja, master, "git://github.com/ninja-build/ninja.git" +opencv, master, "https://github.com/opencv/opencv" +OSMA, master, "https://github.com/fleschutz/OSMA" +PowerShell, master, "https://github.com/fleschutz/PowerShell" +LSS, master, "https://github.com/fleschutz/LSS" +protobuf, master, "https://github.com/protocolbuffers/protobuf" +smartmontools, master, "https://github.com/smartmontools/smartmontools" +tensorflow, master, "https://github.com/tensorflow/tensorflow" +tinycc, master, "https://github.com/TinyCC/tinycc" +voice2json, master, "https://github.com/synesthesiam/voice2json" +zfs, master, "https://github.com/openzfs/zfs" diff --git a/Scripts/clone-repos.ps1 b/Scripts/clone-repos.ps1 index c1184a2a..b370836f 100755 --- a/Scripts/clone-repos.ps1 +++ b/Scripts/clone-repos.ps1 @@ -19,14 +19,15 @@ try { [int]$Count = 0 foreach($Row in $Table) { + $Directory = $Row.Directory + $Branch = $Row.Branch $URL = $Row.URL - $DirName = $Row.Directory - if (test-path "$ParentDir/$DirName" -pathType container) { - "📂$DirName exists already, skipping..." + if (test-path "$ParentDir/$Directory" -pathType container) { + "📂$Directory exists already, skipping..." continue } - "⏳ Cloning 📂$DirName from $URL..." - & git clone --recurse-submodules "$URL" "$ParentDir/$DirName" + "🢃 Cloning 📂$Directory from $URL, $Branch branch..." + & git clone --branch "$Branch" --recurse-submodules "$URL" "$ParentDir/$Directory" if ($lastExitCode -ne "0") { throw "'git clone $URL' failed" } $Count++ }