Reject File - Hunks git apply Could Not Place
What `git apply --reject` leaves behind when a hunk will not apply: the failed hunks alone, under a header that is neither `diff --git` nor a plain `---`/`+++` pair. Ships with its .orig twin so the pair can drive a resolve-the-reject workflow end to end.
diff a/internal/ledger/apply.go b/internal/ledger/apply.go (rejected hunks)
@@ -1,14 +1,21 @@
package ledger
-import "errors"
+import (
+ "errors"
+ "fmt"
+)
// 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.
+// A zero delta is a no-op and never reports an error.
func Apply(balance, delta int64) (int64, error) {
+ if delta == 0 {
+ return balance, nil
+ }
if balance+delta < 0 {
- return balance, ErrShortBalance
+ return balance, fmt.Errorf("%w: balance %d, requested %d", ErrShortBalance, balance, delta)
}
return balance + delta, nil
}
Specifications
- Seed
- 20260807
- Repository Name
- internal/ledger/apply.go.rej
- Produced By
- git apply --reject
- Hunks
- 1
- Header
- diff a/... b/... (rejected hunks)
- Line Endings
- LF
- Encoding
- UTF-8
Testing contract
Expected to pass- Scenario
- Re-apply rejected hunks by hand against the .orig twin in this pair.
- Expected result
- The reject file parses as one file section whose header ends '(rejected hunks)'; applying its hunks to the .orig twin reproduces the intended post-image.
What is a .diff file?
A .diff file records the difference between two versions of one or more text files. The unified format — the default almost everywhere — names the old and new files on `---` and `+++` lines, then lists hunks introduced by `@@ -old,count +new,count @@` in which context lines are unprefixed and changed lines are prefixed with `-` or `+`. Older context and normal diff formats exist but are rarely produced today.
How to use this file
Use an example .diff file to test diff parsers, syntax highlighters, and merge tooling — verifying hunk-offset arithmetic, correct handling of context lines that begin with a space, and behaviour on files whose changes include trailing-whitespace or line-ending differences.
How to use this file for testing
“Reject File - Hunks git apply Could Not Place” is a deterministic Novus Examples fixture for Error handling, Visual diff / regression, Code parsing. Deliberately corrupt and invalid files, clearly labelled, for testing how your tool fails.
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.
Related files
- diffCombined Diff - diff --cc With Two ParentsWhat `git show` prints for a merge commit: a `diff --cc` header, an index line naming three blobs, `@@@` hunk markers, and two prefix columns instead of one. The `++` line is the giveaway a reviewer is looking for — content that appears in the merge result but in neither parent.

- diffCombined Diff - Octopus Merge With Three ParentsAn octopus merge, so the hunk marker grows to `@@@@` and every line carries three prefix columns. Any parser that hard-codes `@@@` or assumes two columns reads the third column as the first character of the line's content.

- diffCombined Diff - Per-Parent mode LineWhen the file mode differs between the parents and the merge result, a combined diff adds a `mode a,b..result` line below the index line — a comma-separated shape that appears nowhere else in git's output. Parsers written for the single-parent `old mode`/`new mode` pair do not recognise it.

- txtMerge Conflict - diff3 Marker Style With Base SectionThe same conflict with `merge.conflictStyle=diff3`, which inserts the merge base between the two sides behind a row of pipes. Tools that split a conflict on `=======` alone silently fold the ancestor text into the ours side.

- txtMerge Conflict - Nested Markers From a Conflicted ResolutionSomeone committed a file that still contained conflict markers, and merging that commit produced markers inside markers. Region matchers that pair the first `<<<<<<<` with the first `=======` split this file in the wrong place and produce two overlapping regions that cannot both be resolved.

- mdMerge Conflict - Real Region Beside Marker LookalikesDocumentation about merge conflicts that quotes the markers inside a fenced code block, and then genuinely conflicts further down. A pre-commit hook that greps for `^<<<<<<<` reports two hits and blocks a clean commit; one that understands Markdown fences reports the one that matters.

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