Test the pruning on open and kill its surviving mutants

This commit is contained in:
2026-11-15 23:17:22 +01:00
parent dbc8cfe854
commit 36d9ddb6f5
2 changed files with 22 additions and 4 deletions
+8 -3
View File
@@ -54,9 +54,7 @@ def main(argv: list[str]) -> int:
return 2
home = pathlib.Path.home()
config = located(None, home)
if not isinstance(config, Failure) and argv[0] == "open":
pruned(config, home)
done = config if isinstance(config, Failure) else act(argv[0], *opened(config, argv[1], home))
done = config if isinstance(config, Failure) else performed(config, argv[0], argv[1], home)
if isinstance(done, Failure):
print(f"project-record: {done.reason}", file=sys.stderr)
return 1
@@ -64,6 +62,13 @@ def main(argv: list[str]) -> int:
return 0
def performed(config: ProjectConfig, command: str, name: str, home: pathlib.Path, run: Git = git) -> str | Failure:
"""What command, one of COMMANDS, prints for the record called name. An open also prunes the copies of removed worktrees."""
if command == "open":
pruned(config, home, run)
return act(command, *opened(config, name, home))
def opened(config: ProjectConfig, name: str, home: pathlib.Path) -> tuple[RecordStore, pathlib.Path]:
"""The store of the record called name, and the copy it gets where it isn't kept as a file. A store that keeps the version it read, for a later save, keeps it beside the copy."""
copy = home / COPIES / config.key / worktree_folder(config.top) / f"{name}.md"