Community
Participate
Working Groups
Build id: I20051108-1011 Steps: 1. Create a java class in a cvs project. Leave a new line (CR) after the last "}" in the file. Create a patch for the file. 2. Remove the newline after the last "}" in the file. Create a patch again. -> Observe: Both(!) patches do not include the new line (CR) at the end of the file. Now, re-apply the patches. In both cases (obviously, since the patch files are identical), a new line (CR) is added after the last "}". I would expect newlines to be exactly the way they were when creating a patch and re-applying it. This is a problem when providing patches with new files for refactoring test cases, as the resulting files do not match anymore.
Just stumbled over this again. A target milestone of 3.4 would be much appreciated.
OK
Thanks :-)
Mass update - removing 3.4 target. This was one of the bugs marked for investigation (and potential fixing) in 3.4 but we ran out of time. Please ping on the bug if fixing it would be really important for 3.4, and does not require API changes or feature work.
Please fix for 3.5. We fall into this trap in every release cycle (this time, it was bug 102020).
Created attachment 109774 [details] Fix v01 The problem here was caused by the fact that when adding new files fileReader#readLine used in DiffOperation#addFileToDiff gave us no information if a read line had a line ending character. The patch changes it, so the last line for an added file is now carefully scanned (char by char) and if it doesn't have CR or LF an extra line is added which informs about that fact (ie "\ \ No newline at end of file"). There is one more thing, the patching mechanism (LineReader to be more precise) uses a flag called "ignoreSingleCR" which when set to true doesn't treat single CR's as line delimiters. I turned this off, but I think it should has the same value as the one used while patching (which is on "to be consistent with command line patch").
Created attachment 109775 [details] mylyn/context/zip
Released to HEAD. Please let me know if this fixes the issues you had, have or would have when creating patches.
Verified on build I20080918-0100.