Skip to content

DeltaType always assigned as CHANGE in UnifiedDiff.parseUnifiedDiff(InputStream stream) #201

Description

@MadnessIRL

Good day everyone,

I am trying to wrap my head around the library, and this might be more of a question rather than a bug(?)...

When parsing unidiffs in this format:
https://github.com/java-diff-utils/java-diff-utils/blob/01a7fb16cfc33abc3e6ac4adcc2db79438f56fcf/java-diff-utils/src/test/resources/com/github/difflib/unifieddiff/jsqlparser_patch_1.diff

line 19 will be raised as change rather than insert:

Image

The object created by parseUnifiedDiff() allows me to re-parse with DiffUtils.diff(delta.getSourceLines, delta.getTargetLines) to obtain the correct DeltaType (in this case INSERT, not CHANGE) but it obviously loses the line numbering (position):

  • original delta obtained by parseUnifiedDiff().getFiles().get(0).getPatch().getDeltas() -
    Image

  • re-parsed with DiffUtils.diff() -
    Image

Perhaps I am doing something wrong... but instinctively, shouldn't parseUnifiedDiff already assign the correct DeltaType?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions