Skip to content

The agent that grows with you

fix(update): drop the duplicate tmp-pack sweep from pack cleanup

Teknium136c01e1d618
diff --git a/hermes_cli/git_pack_tidy.py b/hermes_cli/git_pack_tidy.py
index dc056736df9..d1f3128fd6a 100644
--- a/hermes_cli/git_pack_tidy.py
+++ b/hermes_cli/git_pack_tidy.py
@@ -166,16 +166,10 @@ def _remove_pack(pack: Path) -> int:
def _sweep_remnants(pack_dir: Path) -> None:
- """Finish deletions an earlier run could not complete: pack files whose payload is already gone,
- and ``tmp_*`` transfer files a killed fetch left (a disk-filling fetch storm leaves gigabytes;
- git only prunes them after two weeks). A live transfer keeps writing, so the age guard spares it."""
+ """Finish deletions an earlier run could not complete: pack files whose payload is already gone.
+
+ Aborted-transfer ``tmp_*`` files are gitlock.clear_stale_tmp_packs's job, earlier in the update."""
cutoff = time.time() - _MIN_PACK_AGE_SECONDS
- for part in pack_dir.glob("tmp_*"):
- try:
- if part.stat().st_mtime < cutoff:
- _unlink(part)
- except OSError:
- logger.debug("transfer temp %s still in use", part.name, exc_info=True)
for part in pack_dir.glob("pack-*.*"):
try:
if part.suffix in _PACK_SUFFIXES[1:] and not part.with_suffix(".pack").exists() \
diff --git a/tests/hermes_cli/test_git_pack_tidy.py b/tests/hermes_cli/test_git_pack_tidy.py
index ced9449d60b..c3c0ab1c2c2 100644
--- a/tests/hermes_cli/test_git_pack_tidy.py
+++ b/tests/hermes_cli/test_git_pack_tidy.py
@@ -173,12 +173,7 @@ def test_a_refused_or_killed_erase_leaves_git_reading_and_is_finished_later(
assert tidy.tidy_partial_clone_packs(clone) == tidy.TidyResult(), "ran beside a live lock holder"
finally:
os.close(holder)
- killed_fetch, live_fetch = pack_dir / "tmp_pack_killed", pack_dir / "tmp_pack_live"
- for temp in (killed_fetch, live_fetch):
- temp.write_bytes(b"partial transfer")
- os.utime(killed_fetch, (time.time() - 2 * 3600,) * 2)
tidy.tidy_partial_clone_packs(clone)
assert all(p.with_suffix(".pack").exists() for p in pack_dir.glob("pack-*.*")), \
"leftovers of an interrupted erase survived the next run"
- assert not killed_fetch.exists() and live_fetch.exists(), "a dead fetch's temp file survived, or a live one went"
assert _objects(clone) == held
diff --git a/website/docs/getting-started/updating.md b/website/docs/getting-started/updating.md
index a9e52db2d9a..e7b9c2962e0 100644
--- a/website/docs/getting-started/updating.md
+++ b/website/docs/getting-started/updating.md
@@ -187,7 +187,7 @@ and keep going after a failed update. To recover when that already happened:
`git commit-graph` processes; quitting the app does not stop them.
2. If the disk is completely full, delete the abandoned transfer files to get room back:
`rm -f "$repo"/.git/objects/pack/tmp_pack_*` (Windows: delete `tmp_pack_*` in
- `.git\objects\pack`). Later updates sweep any that are more than an hour old on their own.
+ `.git\objects\pack`). Each update also removes them on its own once no git process is running.
3. Run `hermes update`. It converts the checkout first, then cleans the pack pile down over this
and later updates as described below.