Answer principles round 2: 0 🔴, 0 🟡; test located on a path holding a newline, limit run_scores' comment to bin/

This commit is contained in:
2026-10-21 20:11:26 +02:00
parent 50dcb55d51
commit 185efb9bea
2 changed files with 10 additions and 1 deletions
+1 -1
View File
@@ -111,7 +111,7 @@ def noted(notes: list[str]) -> str:
def run_scores(run: Entry, top: str) -> tuple[RunScores | None, list[str]] | Failure:
"""The run's scores, and why each file left out was: git could not show it as UTF-8, or it does not parse."""
# A tracked name that is not UTF-8 fails the run rather than reading with its bytes replaced: every tool reads git's output through git_repo.git's one contract.
# A tracked name that is not UTF-8 fails the run rather than reading with its bytes replaced: every tool in bin/ but the status line, item 204's, reads git's output through git_repo.git's one contract.
listed = git("ls-tree", "-r", "-z", "--name-only", run.commit, cwd=top)
if isinstance(listed, Failure):
return listed
+9
View File
@@ -174,6 +174,15 @@ class Located(unittest.TestCase):
found = main.located()
self.assertEqual(found, Checkout(str(root), str(root), frozenset({"a.txt", "sub/b.txt"})))
def test_fails_in_a_checkout_whose_path_holds_a_newline(self):
temp = tempfile.TemporaryDirectory()
self.addCleanup(temp.cleanup)
root = pathlib.Path(temp.name, "a\nb")
root.mkdir()
subprocess.run(["git", "init", "--quiet"], check=True, cwd=root, env=isolated_env())
with contextlib.chdir(root):
self.assertIsInstance(main.located(), Failure)
if __name__ == "__main__":
unittest.main()