mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-25 00:51:20 +00:00
fix(disk-cleanup): preserve git internals during empty-dir cleanup
This commit is contained in:
parent
83a7a005aa
commit
8fb0f7b8d8
2 changed files with 48 additions and 1 deletions
|
|
@ -195,6 +195,28 @@ class TestTrackForgetQuick:
|
|||
for d in ("logs", "memories", "sessions", "cron", "cache"):
|
||||
assert (_isolate_env / d).exists(), f"{d}/ should be preserved"
|
||||
|
||||
def test_quick_preserves_git_internal_dirs_and_removes_normal_empty_dirs(self, _isolate_env):
|
||||
dg = _load_lib()
|
||||
checkpoint_heads = _isolate_env / "checkpoints" / "demo" / "refs" / "heads"
|
||||
checkpoint_info = _isolate_env / "checkpoints" / "demo" / "objects" / "info"
|
||||
repo_heads = _isolate_env / "scratch" / "repo" / ".git" / "refs" / "heads"
|
||||
repo_info = _isolate_env / "scratch" / "repo" / ".git" / "objects" / "info"
|
||||
plain_empty = _isolate_env / "scratch" / "empty-dir"
|
||||
|
||||
for p in (checkpoint_heads, checkpoint_info, repo_heads, repo_info):
|
||||
p.mkdir(parents=True, exist_ok=True)
|
||||
(_isolate_env / "checkpoints" / "demo" / "HERMES_WORKDIR").write_text("/tmp/demo\n")
|
||||
plain_empty.mkdir(parents=True)
|
||||
|
||||
summary = dg.quick()
|
||||
|
||||
assert checkpoint_heads.exists()
|
||||
assert checkpoint_info.exists()
|
||||
assert repo_heads.exists()
|
||||
assert repo_info.exists()
|
||||
assert not plain_empty.exists()
|
||||
assert summary["empty_dirs"] == 1
|
||||
|
||||
|
||||
class TestStatus:
|
||||
def test_empty_status(self, _isolate_env):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue