Skip to content

patch: only defer the writes which need deferring#93

Merged
shannonbooth merged 1 commit into
mainfrom
git-patch-boogs
Jul 25, 2026
Merged

patch: only defer the writes which need deferring#93
shannonbooth merged 1 commit into
mainfrom
git-patch-boogs

Conversation

@shannonbooth

Copy link
Copy Markdown
Owner

Every regular write for a Git patch was held back until the whole input had been read, so a later patch in the same input could not see what an earlier one had written. Two commits touching the same file could then fail to apply, and worse, the second patch then committed the file it had read unchanged, silently undoing the first.

Only a rename or a copy needs to be held back, so that two renames which swap a pair of files both read the original content. Install everything else straight away.

Every regular write for a Git patch was held back until the whole input
had been read, so a later patch in the same input could not see what an
earlier one had written. Two commits touching the same file could then
fail to apply, and worse, the second patch then committed the file it
had read unchanged, silently undoing the first.

Only a rename or a copy needs to be held back, so that two renames which
swap a pair of files both read the original content. Install everything
else straight away.
@shannonbooth
shannonbooth merged commit 2d18343 into main Jul 25, 2026
9 checks passed
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