ouroboros/tests/_git_ops_recovery_shared.py
Ouroboros c0fa76dd11 v7next F1: domain D10 - git tools and git_ops G1 split, proof-green; update engine hot-deferred
tools/git.py -> git_plumbing/git_review_cycle/git_evolution/git_repo_edit/
git_vcs_ops (41/42 ledger rows; _refuse_capped_attempt retired upstream by
386e9417). supervisor/git_ops.py (protected) -> G1 leaves remotes/updates/
reset/rescue via the D35 call-time handle (26/28 rows; prepare_managed_update
and safe_restart stay facade defs - the byte gate refuses f-string reads of
rebindable globals). Every moved span proof-checked ast=tokens=bytes against
tip bytes; leaves declare every parent-scope read so facade monkeypatch
targets stay live. update_merge_plan/update_carriers (D34) hot-deferred with
the F2 update engine (upstream redesign deleted _git_run and rewrote all
three insertion points). D13-remainder closure: RELEASE_INVARIANT_PATHS and
_RELEASE_MACHINERY_PATHS cover the four git_ops leaves (additive, D04
precedent), parity pinned. Test splits: test_git_ops_recovery -> 3 siblings
+ shared (48==48), test_git_review_pipeline -> 4 siblings + shared (89==89),
lossless, tip-priority with documented exceptions. Ratchet manifest
regenerated; transplant probe corpus re-pinned to the pre-split base bytes.

Co-authored-by: Ouroboros <311266734+ouroboros-agent@users.noreply.github.com>
(cherry picked from commit 25a24251df579296f461e6508d1f09320fba5ee5)
2026-08-31 00:17:05 +00:00

34 lines
1.1 KiB
Python

"""The throwaway history repositories the git_ops recovery suites work against.
Split out of ``tests/test_git_ops_recovery.py`` when that module was divided by theme; the
builders are verbatim, so every sibling suite starts from the same commits, remotes and
working state it was written against.
"""
from __future__ import annotations
import subprocess
def _git(repo, *args):
return subprocess.run(
["git", *args], cwd=repo, check=True, capture_output=True, text=True
).stdout.strip()
def _history_repo(tmp_path):
repo = tmp_path / "repo"
repo.mkdir()
_git(repo, "init", "-q")
_git(repo, "config", "user.name", "Test")
_git(repo, "config", "user.email", "test@ouroboros")
(repo / "value.txt").write_text("one\n", encoding="utf-8")
_git(repo, "add", "value.txt")
_git(repo, "commit", "-qm", "one")
first = _git(repo, "rev-parse", "HEAD")
_git(repo, "branch", "-M", "ouroboros")
(repo / "value.txt").write_text("two\n", encoding="utf-8")
_git(repo, "commit", "-qam", "two")
second = _git(repo, "rev-parse", "HEAD")
return repo, first, second