diffparser
diffparser copied to clipboard
Files following added files may be ignored by UnifiedDiffParser
With current master (6efdc37) it seems that when a new file is followed by a changed file the later is omitted from the parse results. It seems to have to do with transitioning from a TO_LINE (a "+" prefixed line) to a HEADER line without sufficient warning. I've attached four examples. Here are two failing example where the changed file ("zchanged-file") following the new file is omitted:
- git-new-changed.diff
- gnu-new-changed.diff
And here are two passing examples (all of the files are included in the parse results as expected):
- git-new-changed-prefix.diff
- gnu-new-changed-prefix.diff
In the above "git" means generated by "git diff ..." and "gnu" by GNU diff. For the later there was an empty file in the "a" directory for the new file. For all the diffs the "a" and "b" path prefixes were removed. In the above "prefix" means each file was prepended with "\npath: ...", which is the workaround I'm using.
I've attempted to fix this myself with the attached experimental-concatenated-diff-fix.diff which is in my fork, but doing so broke one of the unit tests, so I did not submit a PR. Also, I'm not sure how you want it to work. added-ignored.zip
I have also encountered this issue, but it seems that the author does not reply any issues or PR, but I really need to build my code on top of this lib.
Is it possible to fix the broken one unit test? Or can you compile a release by skipping the test (-x test)?
You're welcome to take experimental-concatenated-diff-fix.diff in added-ignored.zip attached to my previous comment. I'm sure you can either find some way to skip the tests, or delete the failing test. The build uses Gradle, but for Maven, which Gradle seems to sometimes wrap, it's -DskipTests=true to not run the tests.
I'm not sure I want to get into producing an actual release since I haven't looked at this code in a while, but I wish you luck.