Created
February 23, 2026 18:40
-
-
Save maoyeedy/51abce4952b3f6bfb27ffb246c3e82be to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [CmdletBinding()] | |
| param() | |
| if (-not (Get-Command -Name 'Get-UnityVersion' -ErrorAction SilentlyContinue)) { | |
| . "$PSScriptRoot\functions.ps1" | |
| } | |
| Write-Host "`nConfiguring Git submodules..." -ForegroundColor Yellow | |
| try{ | |
| # git config submodule.recurse true | |
| # git config fetch.recurseSubmodules true | |
| # git config pull.recurseSubmodules true | |
| $postMergeHookPath = ".git/hooks/post-merge" | |
| $lineToAdd = @" | |
| echo -e '\033[1;33mUpdating Submodules...\033[0m' | |
| git submodule update --init --recursive | |
| echo -e '\033[1;32mUpdate Complete\033[0m' | |
| "@ | |
| if (Test-Path $postMergeHookPath) { | |
| $content = Get-Content $postMergeHookPath | |
| if ($content -notcontains 'git submodule update --init --recursive') { | |
| Add-Content -Path $postMergeHookPath -Value "`n$lineToAdd" | |
| } | |
| } | |
| Write-Verbose "Fetching remote submodules..." | |
| git submodule update --init --recursive --remote | |
| Assert-GitExitCode "Failed to update submodules" | |
| Write-Host "Configured Successfully." -ForegroundColor Green | |
| } | |
| catch { | |
| Write-Error "Failed to set Git submodule configurations: $_" | |
| exit 1 | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment