Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Files following added files may be ignored by UnifiedDiffParser #30

Open
selliott512 opened this issue Jul 6, 2019 · 2 comments
Open

Comments

@selliott512
Copy link

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

@Symbolk
Copy link

Symbolk commented Nov 27, 2019

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)?

@selliott512
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants