The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(install): installer rerun heals a partial clone stuck on the pack-objects crash
kshitijk4poor7b20b722699a
diff --git a/scripts/install.ps1 b/scripts/install.ps1index 7ab82037d1f..9e59a4cbb2d 100644--- a/scripts/install.ps1+++ b/scripts/install.ps1@@ -766,6 +766,17 @@ function Stage-Repository {}# Explicit refspec: a tag-pinned --single-branch checkout from an older installer maps only# the tag, so a by-name fetch never writes the origin/$Branch used below (#125112).+ # git 2.53+ aborts fetches into a partial clone whose packs lack a .promisor marker+ # (#124272), and an install stuck there never fetches the updater that heals it.+ # Marking is idempotent and never rewrites objects.+ $promisor = Invoke-Native { git -C $InstallDir config --bool --get remote.origin.promisor }+ $packDir = Join-Path $InstallDir '.git\objects\pack'+ if ("$promisor".Trim() -eq 'true' -and (Test-Path -LiteralPath $packDir)) {+ Get-ChildItem -LiteralPath $packDir -Filter 'pack-*.pack' | ForEach-Object {+ $marker = [IO.Path]::ChangeExtension($_.FullName, '.promisor')+ if (-not (Test-Path -LiteralPath $marker)) { New-Item -ItemType File -Path $marker | Out-Null }+ }+ }Invoke-Logged "Fetching origin/$Branch" { git -C $InstallDir fetch origin "+refs/heads/${Branch}:refs/remotes/origin/${Branch}" }if ($LASTEXITCODE) { Fail "git fetch failed" }$stamp = (Get-Date -Format 'yyyyMMdd-HHmmss')diff --git a/scripts/install.sh b/scripts/install.shindex b6a1d2da176..ef22de6b548 100755--- a/scripts/install.sh+++ b/scripts/install.sh@@ -463,6 +463,15 @@ stage_repository() {# Explicit refspec: a tag-pinned --single-branch checkout from an older# installer maps only the tag, so a by-name fetch writes FETCH_HEAD and# never the origin/$BRANCH everything below resolves (#125112).+ # git 2.53+ aborts fetches into a partial clone whose packs lack a .promisor+ # marker (#124272), and an install stuck there never fetches the updater that+ # heals it. Marking is idempotent and never rewrites objects.+ if [ "$(git -C "$INSTALL_DIR" config --bool --get remote.origin.promisor)" = true ]; then+ local pack+ for pack in "$INSTALL_DIR"/.git/objects/pack/pack-*.pack; do+ if [ -f "$pack" ] && [ ! -e "${pack%.pack}.promisor" ]; then : > "${pack%.pack}.promisor"; fi+ done+ firun_logged "Fetching origin/$BRANCH" git -C "$INSTALL_DIR" fetch origin "+refs/heads/$BRANCH:refs/remotes/origin/$BRANCH" \|| fail "git fetch failed"local stampdiff --git a/tests/scripts/install/test_install_sh_repository_stage.py b/tests/scripts/install/test_install_sh_repository_stage.pyindex ab5e950811d..4d0da0c4ec5 100644--- a/tests/scripts/install/test_install_sh_repository_stage.py+++ b/tests/scripts/install/test_install_sh_repository_stage.py@@ -167,3 +167,26 @@ def test_interactive_stages_skip_without_a_terminal(tmp_path):assert result.returncode == 0, result.stdout + result.stderrassert not marker.exists()assert "no terminal" in result.stdout + result.stderr+++def test_rerun_marks_partial_clone_packs_when_the_fetch_crashes(tmp_path):+ """git 2.53+ aborts fetches into a partial clone with unmarked packs (#124272); the installer+ rerun is the recovery for installs whose own updater cannot fetch, so it marks them first."""+ origin = _origin(tmp_path / "origin")+ assert _stage(tmp_path, origin).returncode == 0+ install = tmp_path / "install"+ _git(install, "config", "remote.origin.promisor", "true")+ _git(install, "repack", "-adq")+ packs = list((install / ".git" / "objects" / "pack").glob("pack-*.pack"))+ assert packs and not any(p.with_suffix(".promisor").exists() for p in packs)+ _commit(origin, "two")+ # Stand-in for the git 2.53+ index-pack crash: any fetch while an unmarked pack exists dies.+ crashing_fetch = (+ 'git() { if [ "${3:-}" = fetch ]; then for p in "$2"/.git/objects/pack/pack-*.pack; do '+ '[ -e "${p%.pack}.promisor" ] || { echo "BUG: should_include_obj" >&2; return 128; }; done; fi; '+ 'command git "$@"; }'+ )+ result = _stage(tmp_path, origin, prelude=crashing_fetch)+ assert result.returncode == 0, result.stdout + result.stderr+ assert (install / "README").read_text() == "two"+ assert all(p.with_suffix(".promisor").exists() for p in packs)