Skip to content

test/reverse: cover Git-derived reversal semantics - #95

Merged
keegancsmith merged 1 commit into
masterfrom
k/reverse-git-fixtures
Sep 10, 2026
Merged

test/reverse: cover Git-derived reversal semantics#95
keegancsmith merged 1 commit into
masterfrom
k/reverse-git-fixtures

Conversation

@keegancsmith

@keegancsmith keegancsmith commented Sep 10, 2026

Copy link
Copy Markdown
Member

This follows #92 with compact fixtures reduced from Git patches. The tests compare complete parsed FileDiff semantics for additions, deletions, renames, mode-only changes, quoted paths, CRLF input, and literal and delta binary patches, and explicitly verify copy rejection without invoking Git at test time.

Git binary patches carry both directions, so swapping the index hashes makes git apply select the inverse payload without reordering the encoded sections. This differs byte-for-byte from git diff -R but still undoes the edit; the fixtures now assert that valid semantic result with no skips. The suite treats diff --git argument rendering as orthogonal, so this PR is compatible with #94 and either can merge first.

go test -race ./..., go vet ./..., and git diff --check origin/master...HEAD pass. I used an AI assistant to help prepare this change and reviewed and tested the result.

Git-derived fixtures guard the directional metadata and hunk behavior added in PR #92 without requiring Git during tests. Binary expectations retain the dual payload ordering because swapped index hashes select the inverse data, while diff header argument rendering stays orthogonal for compatibility with PR #94.

Amp-Thread-ID: https://ampcode.com/threads/T-01a08a2d-c34e-7623-88c1-084780f7dd6d
Co-authored-by: Amp <amp@ampcode.com>
@keegancsmith
keegancsmith marked this pull request as ready for review September 10, 2026 07:59
@keegancsmith
keegancsmith merged commit ae9e610 into master Sep 10, 2026
1 check passed
@keegancsmith
keegancsmith deleted the k/reverse-git-fixtures branch September 10, 2026 08:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant