Skip to content
Novus Examples
patch1.2 KB

Git Patch - Full 40-Character index Hashes

The same patch with `--full-index`, so both blob ids are the complete 40 hex characters. This is what `git apply --3way` needs to find the pre-image blob, and comparing the two twins shows a parser must accept any hash length between 4 and 40.

Preview — first 41 linespatch
From 338104cbd128ea1250a6e24081fe793d0ec5d5da Mon Sep 17 00:00:00 2001
From: Ada Fernsby <ada.fernsby@example.invalid>
Date: Mon, 9 Mar 2026 07:45:19 +0000
Subject: [PATCH] fix(format): reject amounts with no digits

parseMinor returned NaN, which reached the database as 0.
---
 web/src/format.ts | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/web/src/format.ts b/web/src/format.ts
index fd6b21b2a773e913cdc7aabdb41ca296b4083b34..5d40a9feb67de5ae4bcfa5cda560e47fc2eda49d 100644
--- a/web/src/format.ts
+++ b/web/src/format.ts
@@ -1,9 +1,11 @@
 export interface Money {
   amount: number;
   currency: string;
+  locale?: string;
 }
 
 const GROUPING = 3;
+const DEFAULT_LOCALE = "en-GB";
 
 export function formatMinor(minor: number, currency: string): string {
   const sign = minor < 0 ? "-" : "";
@@ -33,5 +35,9 @@
 
 export function parseMinor(text: string): number {
   const cleaned = text.replace(/[^0-9-]/g, "");
-  return Number.parseInt(cleaned, 10);
+  const parsed = Number.parseInt(cleaned, 10);
+  if (Number.isNaN(parsed)) {
+    throw new RangeError("parseMinor: no digits in " + JSON.stringify(text));
+  }
+  return parsed;
 }
-- 
2.43.0

Specifications

Seed
20260807
Index Hash Length
40
Files
1
Produced With
git format-patch --full-index
Pre Image
fd6b21b2a773e913cdc7aabdb41ca296b4083b34
Post Image
5d40a9feb67de5ae4bcfa5cda560e47fc2eda49d
Line Endings
LF
Encoding
UTF-8

Testing contract

Expected to pass
Scenario
Read the pre-image and post-image blob ids out of the index line and look them up.
Expected result
Both ids parse at 40 hex characters and are prefixes of the same full object ids as the twin fixture.

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 - Full 40-Character index Hashes” is a deterministic Novus Examples fixture for Visual diff / regression, Metadata testing, Code parsing. 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.

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