@@ -715,10 +715,18 @@ describe("install.ps1 failure handling", () => {
715715 '$sandbox = Join-Path ([System.IO.Path]::GetTempPath()) ("openclaw-transactional-clone-" + [guid]::NewGuid().ToString("N"))' ,
716716 "New-Item -ItemType Directory -Path $sandbox | Out-Null" ,
717717 "$script:CloneMode = 'success'" ,
718+ "$script:GitFilterSupport = $true" ,
719+ "$script:LastCloneArgs = @()" ,
718720 "$script:ConcurrentRepo = $null" ,
719721 "$script:AliasPath = $null" ,
720722 "$script:AliasReplacement = $null" ,
721723 "function git {" ,
724+ " if ($args[0] -eq 'clone' -and $args[1] -eq '-h') {" ,
725+ " if ($script:GitFilterSupport) { Write-Output ' --[no-]filter <args>' }" ,
726+ " $global:LASTEXITCODE = 129" ,
727+ " return" ,
728+ " }" ,
729+ " if ($args[0] -eq 'clone') { $script:LastCloneArgs = @($args) }" ,
722730 " $target = $args[-1]" ,
723731 " New-Item -ItemType Directory -Force -Path (Join-Path $target '.git') | Out-Null" ,
724732 " Set-Content -LiteralPath (Join-Path $target 'checkout.marker') -Value 'complete'" ,
@@ -738,11 +746,14 @@ describe("install.ps1 failure handling", () => {
738746 " $successRepo = Join-Path $sandbox 'success'" ,
739747 " New-TransactionalGitCheckout -RepoUrl 'https://example.invalid/openclaw.git' -RepoDir $successRepo" ,
740748 " if (-not (Test-Path -LiteralPath (Join-Path $successRepo 'checkout.marker'))) { throw 'complete checkout was not published' }" ,
749+ " if ($script:LastCloneArgs -notcontains '--filter=blob:none') { throw 'supported Git did not use a filtered clone' }" ,
741750 "" ,
742751 " $emptyRepo = Join-Path $sandbox 'empty'" ,
743752 " New-Item -ItemType Directory -Path $emptyRepo | Out-Null" ,
753+ " $script:GitFilterSupport = $false" ,
744754 " New-TransactionalGitCheckout -RepoUrl 'https://example.invalid/openclaw.git' -RepoDir $emptyRepo" ,
745755 " if (-not (Test-Path -LiteralPath (Join-Path $emptyRepo 'checkout.marker'))) { throw 'empty destination was not populated' }" ,
756+ " if ($script:LastCloneArgs -contains '--filter=blob:none') { throw 'unsupported Git used a filtered clone' }" ,
746757 "" ,
747758 " $aliasTarget = Join-Path $sandbox 'alias-target'" ,
748759 " $script:AliasReplacement = Join-Path $sandbox 'alias-replacement'" ,
@@ -1244,6 +1255,7 @@ describe("install.ps1 failure handling", () => {
12441255 const pnpmVersionBody = extractFunctionBody ( source , "Get-RepoPnpmVersion" ) ;
12451256 const pnpmVersionMatchBody = extractFunctionBody ( source , "Test-PnpmCommandMatchesVersion" ) ;
12461257 const ensurePnpmBody = extractFunctionBody ( source , "Ensure-Pnpm" ) ;
1258+ const gitFilterSupportBody = extractFunctionBody ( source , "Test-GitFilterSupport" ) ;
12471259 const transactionalCloneBody = extractFunctionBody ( source , "New-TransactionalGitCheckout" ) ;
12481260 const gitInstallBody = extractFunctionBody ( source , "Install-OpenClawFromGit" ) ;
12491261 const nodeOptionsBody = extractFunctionBody ( source , "Resolve-NodeOptionsWithMinOldSpace" ) ;
@@ -1271,7 +1283,10 @@ describe("install.ps1 failure handling", () => {
12711283 expect ( ensurePnpmBody ) . toContain (
12721284 'Invoke-NpmCommand -Arguments @("install", "-g", "--force", $pnpmSpec)' ,
12731285 ) ;
1274- expect ( transactionalCloneBody ) . toContain ( "git clone $RepoUrl $stagingDir" ) ;
1286+ expect ( gitFilterSupportBody ) . toContain ( "git clone -h" ) ;
1287+ expect ( gitFilterSupportBody ) . toContain ( "filter" ) ;
1288+ expect ( transactionalCloneBody ) . toContain ( '$cloneArgs += "--filter=blob:none"' ) ;
1289+ expect ( transactionalCloneBody ) . toContain ( "& git @cloneArgs" ) ;
12751290 expect ( gitInstallBody . indexOf ( "New-TransactionalGitCheckout" ) ) . toBeLessThan (
12761291 gitInstallBody . indexOf ( "Ensure-Pnpm -RepoDir $RepoDir" ) ,
12771292 ) ;
0 commit comments