Test the pruning on open and kill its surviving mutants
This commit is contained in:
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user