Skip to content

A bug in DiffText1 #29

@tkf

Description

@tkf

With some texts, DiffText1 returns a wrong result. An example of such data is dmp.go of revision b94bf7 and b94bf7^. To see this, get text1.go (which just prints DiffText1) from https://gist.github.com/tkf/12bde871bf794e59bea88b659ed5b95b and run it as:

cd PATH/TO/go-diff/diffmatchpatch
diff <(go run PATH/TO/text1.go <(git show 'b94bf7:./dmp.go') <(git show 'b94bf7^:./dmp.go')) <(git show 'b94bf7:./dmp.go')

which pints

471c471
<

---
>                                       break
658c658
<

---
>

i.e., dmp.DiffText1(diffs) != text1.

The above gist also includes text1.bash which automates finding such examples. For example, I found many such examples by running:

git clone https://go.googlesource.com/go
cd go/src
PATH/TO/text1.bash **/*.go > examples

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