
More than you really wanted to know about Patch - signa11
http://lists.landley.net/pipermail/toybox-landley.net/2019-January/010049.html
======
smcameron
If you ever find yourself needing to maintain a set of patches to apply to two
or more similar codebases (e.g. various linux kernels of various distros), I
found stacked git to be very helpful for that purpose.
[http://www.procode.org/stgit/](http://www.procode.org/stgit/) (or maybe just
apt-get install stgit).

~~~
pm215
Yes, I can definitely recommend stgit if what you're doing is basically
"maintain this stack of patches". It's much more user-friendly as an UI for
doing that than raw git rebase, though of course you can achieve the same
workflow with the basic git plumbing.

------
JdeBP
Of course, this idea goes back further than "back in the 1980s" with Larry
Wall.

In the mainframe world of the decade before that, people had ZAP, which later
was to become SPZAP, OBJZAP, and AMASPZAP (not IAMASPZAP as the Hacker's
Dictionary erroneously has it). ZAP's "NAME", "VER", and "REP" records work
similarly to the process described by M. Landley: name the file, verify that
the original contents at a particular place are thus, replace them with some
new contents if so.

ZAP could also twiddle metadata, record patches applied, and dump contents. It
has several imitators.

* [https://ibm.com/support/knowledgecenter/en/SSB27U_6.4.0/com....](https://ibm.com/support/knowledgecenter/en/SSB27U_6.4.0/com.ibm.zvm.v640.dmsb4/zapp.htm)

* [https://ibm.com/support/knowledgecenter/en/SSLTBW_2.3.0/com....](https://ibm.com/support/knowledgecenter/en/SSLTBW_2.3.0/com.ibm.zos.v2r3.ieav100/spzap.htm)

* [https://support.sas.com/documentation/onlinedoc/sasc/doc/tec...](https://support.sas.com/documentation/onlinedoc/sasc/doc/techsup/zenid-24.htm)

* [https://m204wiki.rocketsoftware.com/index.php/RockZap](https://m204wiki.rocketsoftware.com/index.php/RockZap)

~~~
samat
Thanks for the links provided, made me happy to realise I don't have to parse
that documentation :)

------
pjtr
I was very surprised to learn that diff / patch file formats are essentially
unstandardized. Shouldn't there be an RFC or something?

~~~
chii
It's standardized the same way Perl is standardized - whatever the reference
implementation does is the standard!

------
gglitch
I hope someone somewhere is compiling this kind of material for the Foundation
time capsule.

------
u801e
After reading the man page for diff and the -e option, I found that they
actually generate the diff hunks from the end of the file to the beginning in
order to keep the start line numbers consistent. I wonder why the other diff
formats decided to do it the other way around (from beginning to end)? Doing
it from end to beginning actually makes it easier to apply individual hunks
without having to regenerate the diff after applying one (assuming you start
with a later hunk before applying earlier ones).

------
anitil
That was quite refreshing to read. It's funny how little thought I'd given to
such a vital tool

I had a good chuckle at 'given a choice between "system with no battery" and
"system with systemd" it's no contest'

------
jancsika
patch: hey everybody look at javascript it has _two_ nulls. wat lol

javascript: at least my nulls aren't like _midnight, january 1, 1970_

unix: damn js that's an _epoch_ burn

