Spaces:
Running
Running
| param( | |
| [Parameter(Mandatory = $true)] | |
| [string]$Branch, | |
| [Parameter(Mandatory = $true)] | |
| [string[]]$Scope | |
| ) | |
| $ErrorActionPreference = "Stop" | |
| $remoteRef = "origin/$Branch" | |
| Write-Host "[pull-scope] fetch $remoteRef" | |
| git fetch origin $Branch | |
| if ($LASTEXITCODE -ne 0) { | |
| throw "git fetch failed for branch: $Branch" | |
| } | |
| foreach ($path in $Scope) { | |
| Write-Host "[pull-scope] apply $path from $remoteRef" | |
| git restore --source $remoteRef --staged --worktree -- $path | |
| if ($LASTEXITCODE -ne 0) { | |
| throw "git restore failed for scope: $path" | |
| } | |
| } | |
| Write-Host "[pull-scope] completed" | |