test/reverse: cover Git-derived reversal semantics - #95
Merged
Conversation
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
force-pushed
the
k/reverse-git-fixtures
branch
from
September 10, 2026 07:31
d2cbb17 to
48be038
Compare
keegancsmith
marked this pull request as ready for review
September 10, 2026 07:59
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This follows #92 with compact fixtures reduced from Git patches. The tests compare complete parsed
FileDiffsemantics 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 applyselect the inverse payload without reordering the encoded sections. This differs byte-for-byte fromgit diff -Rbut still undoes the edit; the fixtures now assert that valid semantic result with no skips. The suite treatsdiff --gitargument rendering as orthogonal, so this PR is compatible with #94 and either can merge first.go test -race ./...,go vet ./..., andgit diff --check origin/master...HEADpass. I used an AI assistant to help prepare this change and reviewed and tested the result.