Skip to content

Expose sentinel error for reversing Git copies - #93

Merged
keegancsmith merged 1 commit into
masterfrom
k/reverse-copy-error
Sep 10, 2026
Merged

Expose sentinel error for reversing Git copies#93
keegancsmith merged 1 commit into
masterfrom
k/reverse-copy-error

Conversation

@keegancsmith

Copy link
Copy Markdown
Member

This is a narrow follow-up to #92. Git copy diffs are valid input but cannot be reversed because they lack enough information to delete the copied file. ReverseFileDiff now returns the exported ErrCannotReverseCopy sentinel for that case, allowing callers to distinguish it from other failures by direct equality (and therefore with errors.Is as well) without changing the existing error text or reversal behavior.

The focused copy-diff test now verifies the sentinel identity. Validation passed with go test -race ./..., go vet ./..., and git diff --check.

Callers need a stable way to distinguish the valid-but-unsupported Git copy case from other reversal failures. Exposing and returning a sentinel preserves the existing behavior while making that condition programmatically detectable.

Amp-Thread-ID: https://ampcode.com/threads/T-01a08a2d-a5f9-726c-bf53-aab80421f8ef
Co-authored-by: Amp <amp@ampcode.com>
@keegancsmith
keegancsmith marked this pull request as ready for review September 10, 2026 07:58
@keegancsmith
keegancsmith merged commit 3aa67b9 into master Sep 10, 2026
1 check passed
@keegancsmith
keegancsmith deleted the k/reverse-copy-error branch September 10, 2026 07:58
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