Skip to content

Files following added files may be ignored by UnifiedDiffParser #30

@selliott512

Description

@selliott512

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions