This commit is contained in:
@@ -83,4 +83,25 @@ def test_checkpoint_restores_last_valid_changes(tmp_path) -> None:
|
||||
workspace.restore_checkpoint(checkpoint)
|
||||
|
||||
assert tracked.read_text() == "<?php\nreturn ['valid'];\n"
|
||||
assert added.exists()
|
||||
assert added.exists()
|
||||
|
||||
|
||||
def test_diff_returns_discarded_patch_excerpt(tmp_path) -> None:
|
||||
workspace = GitWorkspace(settings(workspace_root=tmp_path), 5)
|
||||
workspace.path.mkdir()
|
||||
subprocess.run(["git", "init"], cwd=workspace.path, check=True, capture_output=True)
|
||||
tracked = workspace.path / "service.php"
|
||||
tracked.write_text("<?php\nreturn 'old';\n")
|
||||
subprocess.run(["git", "add", "."], cwd=workspace.path, check=True)
|
||||
subprocess.run(
|
||||
["git", "-c", "user.email=test@example.invalid", "-c", "user.name=Test", "commit", "-m", "base"],
|
||||
cwd=workspace.path,
|
||||
check=True,
|
||||
capture_output=True,
|
||||
)
|
||||
tracked.write_text("<?php\nreturn 'new';\n")
|
||||
|
||||
patch = workspace.diff()
|
||||
|
||||
assert "-return 'old';" in patch
|
||||
assert "+return 'new';" in patch
|
||||
Reference in New Issue
Block a user