Skip to content

UnifiedDiffParserException on apparently sane file #104

@moio

Description

@moio

Describe the bug
UnifiedDiffReader.parseUnifiedDiff throws UnifiedDiffParserException on a patch which apparently looks good:

https://git.stg.centos.org/rpms/adcli/blob/f29/f/0015-make-Samba-data-tool-configurable.patch

To Reproduce
Run this program: https://gist.github.com/moio/e6357cdd23d7645466c005004c4aa95c

(contains the literal patch as a string)

Expected behavior

No Exceptions.

Actual behavior

Dec 11, 2020 5:40:52 PM com.github.difflib.unifieddiff.UnifiedDiffReader processLine
WARNING: >>> no rule matched diff --git a/library/adenroll.c b/library/adenroll.c
Exception in thread "main" com.github.difflib.unifieddiff.UnifiedDiffParserException: expected data line not found
at com.github.difflib.unifieddiff.UnifiedDiffReader.parse(UnifiedDiffReader.java:104)
at com.github.difflib.unifieddiff.UnifiedDiffReader.parseUnifiedDiff(UnifiedDiffReader.java:146)
at Main.main(Main.java:303)
...

System

  • Java version: openjdk-11
  • Version: 4.9

Suspect

This diff line has a --git parameter which is not understood by the parser:

diff --git a/configure.ac b/configure.ac

Notes

👋 java-diff-utils maintainers! Thanks for this library, it's helping me considerably! I am happy to test any PR to fix this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions