Does anyone know how to write a unified diff so that it will not add lines as duplicate that are already there at the end of a file?
The end of file is key, because there's no context below to cause the matching to fail.
Specifically, here is what happened:
I applied this patch:
@@ -172,3 +172,7 @@
EXTEND_BOTTOM ~dwface04.bcs~ ~fadingpromises/script/b!dwface04.baf~
END
+ELSE BEGIN
+ COPY_EXISTING ~UDTRAP04.cre~ ~override~
+ ADD_CRE_ITEM ~b!amace~ #0 #0 #0 ~IDENTIFIED~ ~INV16~
+END
To a file that already had those lines at the end (this is before patching):
EXTEND_BOTTOM ~dwface04.bcs~ ~fadingpromises/script/b!dwface04.baf~
END
ELSE BEGIN
COPY_EXISTING ~UDTRAP04.cre~ ~override~
ADD_CRE_ITEM ~b!amace~ #0 #0 #0 ~IDENTIFIED~ ~INV16~
END
Which resulted in this:
EXTEND_BOTTOM ~dwface04.bcs~ ~fadingpromises/script/b!dwface04.baf~
END
ELSE BEGIN
COPY_EXISTING ~UDTRAP04.cre~ ~override~
ADD_CRE_ITEM ~b!amace~ #0 #0 #0 ~IDENTIFIED~ ~INV16~
END
ELSE BEGIN
COPY_EXISTING ~UDTRAP04.cre~ ~override~
ADD_CRE_ITEM ~b!amace~ #0 #0 #0 ~IDENTIFIED~ ~INV16~
END
Section in red was added by the patcher, because from its perspective, it saw the two lines above (green) as a match and didn't look beyond because when the patch was originally created, the file ended after those two green lines.
Any tips on how to handle this situation?