Skip to content

Commit

Permalink
Updated Get-GitModules.ps1 and download.sh from main
Browse files Browse the repository at this point in the history
(cherry picked from commit cb629a9)
  • Loading branch information
slouken committed Dec 14, 2024
1 parent 1dd0f99 commit 206a3fd
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
9 changes: 7 additions & 2 deletions external/Get-GitModules.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,13 @@
[String] $PathRegex = "path\s*=\s*(?<path>.*)"
[String] $URLRegex = "url\s*=\s*(?<url>.*)"
[String] $BranchRegex = "branch\s*=\s*(?<Branch>.*)"
[String] $Arguments = $($args -join " ")

#------- Script ----------------------------------------------------------------
if ([string]::IsNullOrEmpty($Arguments)) {
$Arguments = "--depth 1"
}

foreach ($Line in Get-Content $PSScriptRoot\..\.gitmodules) {
if ($Line -match $PathRegex) {
$Match = Select-String -InputObject $Line -Pattern $PathRegex
Expand All @@ -29,8 +34,8 @@ foreach ($Line in Get-Content $PSScriptRoot\..\.gitmodules) {
$Match = Select-String -InputObject $Line -Pattern $BranchRegex
$Branch = $Match.Matches[0].Groups[1].Value

Write-Host "git clone $URL $Path -b $Branch --recursive" `
Write-Host "git clone --filter=blob:none $URL $Path -b $Branch --recursive $Arguments" `
-ForegroundColor Blue
git clone $URL $PSScriptRoot/../$Path -b $Branch --recursive
git clone --filter=blob:none $URL $PSScriptRoot/../$Path -b $Branch --recursive $Arguments
}
}
9 changes: 8 additions & 1 deletion external/download.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

set -e

ARGUMENTS="$*"

cd $(dirname "$0")/..
cat .gitmodules | \
while true; do
Expand All @@ -12,5 +14,10 @@ while true; do
url=$3
read line; set -- $line
branch=$3
git clone $url $path -b $branch --recursive

if [ -z "$ARGUMENTS" ]; then
ARGUMENTS="--depth 1"
fi

git clone --filter=blob:none $url $path -b $branch --recursive $ARGUMENTS
done

0 comments on commit 206a3fd

Please sign in to comment.