Skip to content

Commit d0cc49b

Browse files
committed
Update readme
1 parent 2fd785b commit d0cc49b

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,15 @@
66

77
Go implementation of the Patience Diff algorithm.
88

9+
## About
10+
11+
Patience Diff is an algorithm credited to [Bram Cohen](https://bramcohen.livejournal.com/73318.html) that produces diffs tending to be more human-readable than the common diff algorithm.
12+
913
The common diff algorithm is based on the [longest common subsequence](https://en.wikipedia.org/wiki/Longest_common_subsequence_problem) problem.
1014
It is credited to [Eugene Myers](http://www.xmailserver.org/diff2.pdf) and is the default diff algorithm in Git.
1115
While the diffs generated by this algorithm are efficient, in many cases they tend not to correspond to what humans would naturally identify.
1216

13-
Patience Diff also relies on computing the longest common subsequence, but the approach taken produces diffs that tend to be more human-readable.
17+
Patience Diff, while also relying on computing the longest common subsequence, takes a different approach. It only computes the longest common subsequence of the *unique*, *common* elements of both texts. This means that lines that are frequently non-unique, such as those containing a single brace or new line character, are ignored. The result is that distinctive lines, such as function declarations, become the anchor points of commonality between the two texts.
1418

1519
## Example
1620

@@ -114,7 +118,5 @@ diff := patience.DiffText(diffs)
114118

115119
## References
116120

117-
The patience diff algorithm is credited to Bram Cohen.
118-
119121
- [Patience Diff Advantages](https://bramcohen.livejournal.com/73318.html) by Bram Cohen
120122
- [Patience Diff, a brief summary](https://alfedenzo.livejournal.com/170301.html) by Alfedenzo

0 commit comments

Comments
 (0)