Reputation: 1569
can we edit the patch in a such a way that it remains valid even after edit?
We have a patch which applies to one source tree, now to support other platform we copied the configuration files and renamed, some of the patches would remain the same but it should contain the new file-name.
Is there a way to edit patch and keeping patch valid in this situation ?
Upvotes: 0
Views: 319
Reputation: 98328
Yes, patch files are text files and can be edited manually if done with care.
The file names are in the hunk headers:
--- a/filename details
+++ b/filename details
@@ -X1,L1 +X2,L2 @@
The details
(modified date, usually) are ignored, and the a
/b
are dummy directories to make patch
happy thinking that the original file is different from the modified one (that's the 1 in patch -p1
).
The numbers X1
,X2
are the original and modified line numbers where the hunk begins. The L1
and L2
numbers are the original and modified lenghts of the chunk.
And that's all! Just change filename
on both +++
and ---
lines and everything just works.
Upvotes: 3