2 ms·
If I'm understanding you correctly you are wondering why some filenames are named .old in the header of patch files. If so, then that is likely an easy answer.
by pwg 6y ago
If I'm understanding you correctly you are wondering why some filenames are named .old in the header of patch files.
If so, then that is likely an easy answer. No one creates patch files by hand, they are created by diff (or similar tools).
And diff, at least the Unix variant, is used to compare two files and produce an output that will change the first of the two into the second of the two (i.e., it outputs the 'differences' between the two files, hence the utility's name 'diff').
Well, to have two files, one of the files has to be given a different name. So if one is editing a single file, and is not using some kind of source control system that tracks changes, it is common to first do:
cp file_to_be_edited file_to_be_edited.old
Then, edit "file_to_be_edited".
Then produce a patch by doing:
diff -u file_to_be_edited.old file_to_be_edited > file_to_be_edited.diff
And since diff puts the filenames of the two files it compares into the header lines of the output unified diff format, you get a file named .old showing up in the output patch file.
- inopinatus 6y agoWell I just want to stop you right there and say that I have sinned and written diffs by hand, and what’s more they were for a sendmail.cf, and if this conjures visions of a cantankerous sandal-wearing Unix admin then so be it
- rascul 6y agoI just got flashbacks. My night is now ruined.