Skip to content
Novus Examples
patch724 B

Git Patch - Mode Change Plus Content Edit

The same file changes permissions and content in one commit, so the mode headers are followed by an `index` line and a normal hunk. Applying only the hunk and silently ignoring the mode is the common failure, and it leaves a script that is no longer executable.

Preview — first 27 linespatch
From ad803ca10a1ac868c0d553a3ce530ca9c5a6d1b5 Mon Sep 17 00:00:00 2001
From: Ada Fernsby <ada.fernsby@example.invalid>
Date: Thu, 5 Mar 2026 08:52:47 +0000
Subject: [PATCH] fix(release): require a version argument

Running release.sh with no argument tagged the empty string.
---
 scripts/release.sh | 1 +
 1 file changed, 1 insertion(+), 0 deletions(-)
 mode change 100644 => 100755 scripts/release.sh

diff --git a/scripts/release.sh b/scripts/release.sh
old mode 100644
new mode 100755
index 16ecf13..624d539
--- a/scripts/release.sh
+++ b/scripts/release.sh
@@ -1,4 +1,5 @@
 #!/bin/sh
 set -eu
 VERSION="$1"
+test -n "$VERSION" || { echo "usage: release.sh <version>" >&2; exit 2; }
 echo "tagging $VERSION"
-- 
2.43.0

Specifications

Seed
20260807
Extended Header
old mode / new mode + index
Files
1
Hunks
1
Old Mode
100644
New Mode
100755
Line Endings
LF
Encoding
UTF-8

Testing contract

Expected to pass
Scenario
Apply a patch that changes both the mode and the contents of one file.
Expected result
scripts/release.sh ends with mode 100755 and the added guard line; both parts of the change are applied.

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 - Mode Change Plus Content Edit” 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.

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