Age | Commit message (Collapse) | Author |
|
|
|
Keep track of last hunk offset so we are more likely to find future
hunks.
Start search within the range of lines where we could possibly find
the hunk. This fixes a bug where if the file shrunk since the patch
was generated, and we start the search past the end of the file and
immediately abort the search.
Add an extra offset for the end of the file to the lines array so that
lines[nlines] is the length of the file. This way, when we start the
search at line nlines-oldcnt, we don't access past the end of the array
if oldcnt==0.
When we find a hunk, set lastln to ln + h->oldcnt; we can't apply
another hunk that starts before the previous hunk ends.
|
|
Previously, hunks that end exactly at the end of the file could not be
found when the matching lines were located at a positive offset.
|
|
Consecutive delete hunks will both have newpath of /dev/null, but we
need to reslurp oldpath between these hunks.
|
|
|
|
It sysfatals if it fails and has no non-success returns.
|
|
If we are deleting a file, we do not want to attempt to create an
empty /dev/null.tmp$pid.
finish() doesn't look at tmp for deletions during a successful run, so
leave it set to nil. On a failure, guard tmp removal on tmp != nil.
|
|
|
|
|
|
Here, patch grows a dry run option (-n), which allows
git/import to bail out early if it would patch files
that are dirty in tree.
Once git/import refuses to patch dirty files, git/rebase
can skip checking if the whole tree is clean, which is
both convenient and much faster on large trees.
|
|
When applying a patch, we used to write out the patch,
rename the file, and then move to the next one. This
meant that if a patch failed to apply cleanly, we would
leave the patch half-applied.
This sucked, so we now apply the patch as a whole unit,
or not at all.
|
|
Some programs will strip trailing spaces from hunks;
in this case we want to treat the line as though it
came with a leading space.
This fixes applying some patches, such as
[PATCH] Permissions for child boards in /srv
|
|
ape/patch is a giant, ugly ball of code from almost 25 years ago,
which has not and will likely never been updated or maintained.
the world has since settled on unified diffs, and we just need a
simple program that can parse and apply them.
|