Skip to content

Parsing of diffs on windows fails #28

Closed
@crsdrw

Description

@crsdrw

Running the standard GNU diff tool on windows can produce diff output with CRLF line endings instead of LF line endings. This currently causes an error in this diff parser.

To reproduce, run the go-diff diagnostic tool on the attached diff:

go-diff -f sample_diff_win.txt

and get the following error:

err read file(0): line 3, char 116: bad hunk header: @@ -1,3 +1,9 @@

The parser uses an in-built line reader instead of bufio.Scanner which does not strip trailing CR characters from lines (unlike bufio.Scanner)

sample_diff_win.txt

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