From e6d2168a13a195124ba908a0fdd97f2814b82d0c Mon Sep 17 00:00:00 2001 From: Godopu Date: Mon, 14 Sep 2026 21:31:18 +0000 Subject: [PATCH] test(issue-21): L13 compares against the pre-change diff_collect only when git history is available The byte-identity check of the two-argument form read the old script with `git show 25f4be3:...`, which fails in a `git archive` export (no .git) and failed the test there. The comparison now runs only when the old script can be read; the two-argument path is otherwise still covered by test_b7_diff_untracked. L13 passes in the repository and in an export. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_017R3Eg7MEpSWnm1oB9ZPP6G --- tests/test_issue21_loop_b.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tests/test_issue21_loop_b.py b/tests/test_issue21_loop_b.py index f7742f2..9918e01 100644 --- a/tests/test_issue21_loop_b.py +++ b/tests/test_issue21_loop_b.py @@ -332,12 +332,14 @@ def test_l13_snapshot_diff_is_commit_to_commit(wt_repo, monkeypatch, tmp_path): # the two-argument form is unchanged: same output as the script before this change old = subprocess.run(["git", "-C", str(SKILLS.parent.parent), "show", "25f4be3:.agents/skills/multi-agent-mux-loop/scripts/diff_collect.sh"], capture_output=True, text=True) - old_sh = tmp_path / "diff_collect_old.sh" - old_sh.write_text(old.stdout) new2 = _diff_collect(wt, base) - old2 = subprocess.run(["bash", "-c", f"source '{old_sh}' && mam_collect_changes_diff '{wt}' '{base}'"], - capture_output=True, text=True) - assert (new2.returncode, new2.stdout) == (old2.returncode, old2.stdout) + assert new2.returncode == 0 and "+modified" in new2.stdout and "+untracked" in new2.stdout + if old.returncode == 0 and old.stdout: # needs git history (absent in a `git archive` export) + old_sh = tmp_path / "diff_collect_old.sh" + old_sh.write_text(old.stdout) + old2 = subprocess.run(["bash", "-c", f"source '{old_sh}' && mam_collect_changes_diff '{wt}' '{base}'"], + capture_output=True, text=True) + assert (new2.returncode, new2.stdout) == (old2.returncode, old2.stdout) def test_l13b_prompt_diff_comes_from_the_snapshot(wt_repo, monkeypatch, tmp_path):