Git Patch - Copy Detection at similarity index 85%
`copy from`/`copy to` headers, produced only when copy detection is enabled with `-C`. The source file still exists afterwards, which is the whole difference from a rename — and the difference a parser that maps both header pairs onto one 'moved' concept silently erases.
From d3ce9f55473492d67f074bd28926052ed2f27811 Mon Sep 17 00:00:00 2001
From: Ada Fernsby <ada.fernsby@example.invalid>
Date: Fri, 6 Mar 2026 10:44:05 +0000
Subject: [PATCH] ledger: add a strict variant of Apply
Generated with format-patch -C so the shared history is visible in review.
---
internal/ledger/{apply.go => apply_strict.go} | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
copy internal/ledger/{apply.go => apply_strict.go} (85%)
diff --git a/internal/ledger/apply.go b/internal/ledger/apply_strict.go
similarity index 85%
copy from internal/ledger/apply.go
copy to internal/ledger/apply_strict.go
index 95f499d..3211ad6 100644
--- a/internal/ledger/apply.go
+++ b/internal/ledger/apply_strict.go
@@ -5,8 +5,8 @@
// ErrShortBalance is returned when a posting would drive the balance negative.
var ErrShortBalance = errors.New("ledger: insufficient balance")
-// Apply posts one delta against the running balance and returns the new total.
-func Apply(balance, delta int64) (int64, error) {
+// ApplyStrict posts one delta against the running balance and returns the new total.
+func ApplyStrict(balance, delta int64) (int64, error) {
if balance+delta < 0 {
return balance, ErrShortBalance
}
--
2.43.0
Specifications
- Seed
- 20260807
- Extended Header
- similarity index / copy from / copy to
- Files
- 1
- Similarity Index
- 85
- Produced With
- git format-patch -C
- Line Endings
- LF
- Encoding
- UTF-8
Testing contract
Expected to pass- Scenario
- Apply a patch containing copy from / copy to headers and check the source file afterwards.
- Expected result
- internal/ledger/apply_strict.go is created AND internal/ledger/apply.go still exists unchanged.
What is a .patch file?
A .patch file is a unified diff packaged for transmission, most often as produced by `git format-patch`. Beyond the diff itself it carries an email-style header with the author, date, and commit subject, a commit message body, per-file `diff --git` headers recording renames and mode changes, and hunk headers of the form `@@ -old,count +new,count @@`. Applying it reconstructs a specific change against a specific before-state.
How to use this file
Use an example .patch file to test patch application, code-review renderers, and diff parsers — exercising renames, mode changes, binary hunks, added and deleted files, and the `\ No newline at end of file` marker that naive parsers silently drop.
How to use this file for testing
“Git Patch - Copy Detection at similarity index 85%” is a deterministic Novus Examples fixture for Visual diff / regression, Code parsing, Editor testing. A/B image twins with controlled pixel changes, anti-alias variants, and UI chrome crops for screenshot diff and visual regression tools.
Documented properties for this file: seed 20260807 · UTF-8 · LF. Compare results against paired or grouped companions on this page when present (clean↔damaged, searchable↔scanned, or format twins) so scores stay reproducible across runs.
Download the file once, keep the path stable in CI or local scripts, and treat the spec table as the contract: dimensions, seeds, field lists, and roles are intentional. Corrupt or invalid samples are labelled as such — expect parsers to fail loudly rather than silently accept them.
Diff and patch fixtures name their target paths and the exact edge case they exercise — rename, mode change, binary hunk, CRLF↔LF, or missing trailing newline. Apply or render them against the documented before-state; every author, path, and hash is fictional.
Treat A/B twins as a visual regression unit: run your pixel or perceptual diff, assert a non-zero delta on the changed twin, and keep thresholds calibrated against the documented change kind in specs.
Related files
- patchGit Format-Patch Series - 0000 Cover LetterThe `--cover-letter` message git writes ahead of a series: a `[PATCH 0/3]` subject, a shortlog of the authors and their subjects, and the combined diffstat — but no diff of its own. Series tooling has to recognise it as metadata and not try to apply it.

- patchGit Format-Patch Series - 0001 of 3Patch 1 of a three-message series, threaded under the cover letter with In-Reply-To and References headers. Applying the three out of order breaks: the series is only self-consistent in numeric order.

- patchGit Format-Patch Series - 0002 of 3Patch 2 of a three-message series, threaded under the cover letter with In-Reply-To and References headers. Applying the three out of order breaks: the series is only self-consistent in numeric order.

- patchGit Format-Patch Series - 0003 of 3Patch 3 of a three-message series, threaded under the cover letter with In-Reply-To and References headers. Applying the three out of order breaks: the series is only self-consistent in numeric order.

- patchGit Patch - deleted file mode HeaderA deletion of an executable file, so the `deleted file mode 100755` header records the mode the file had rather than the mode to create. A patcher that writes an empty file here instead of unlinking leaves a broken executable behind.

- patchGit Patch - Every Extended Header in One CommitThe torture test: one commit that creates a file, deletes an executable, renames at 100%, copies with detection on, changes a mode while editing, and adds a binary blob. The diffstat carries the matching create/delete/rename/mode-change summary lines that follow the file table.

Generated by generation/version_control.py. Free for any use, no attribution required — license.