1767: Diff engine incorrectly interprets block moves
- WontFix
- Review Board
sed***@gmai***** (Google Code) (Is this you? Claim this profile.) | |
March 21, 2011 |
What version are you running? 1.0.9 What's the URL of the page containing the problem? /rb/r/22/diff/1/?file=1560#file1560line42 What steps will reproduce the problem? 1. Commit this code block: {{{ bool a = true; bool b = false; bool c = false; bool d = true; }}} 2. Move first line to the end of the block. 3. In RB diff, it's not shown as a block move, but rather edit of each line. What is the expected output? What do you see instead? You expect it to be shown as "first line deleted", "last line added". What operating system are you using? What browser? Windows. Firefox. An example screenshot is attached.
The tricky thing about diff algorithms is that you can never get 100% satisfactory results. Any change we make to the algorithm would impact existing diffs. We're actually using a fairly standard algorithm for this, the Meyers Diff Algorithm combined with some enhancements used by GNU Diff and other differs. In this case, the algorithm is for whatever reason seeing that there are a bunch of lines small and similar enough that some text has changed, rather than seeing full inserts/deletes. We may not be able to fix this, but it's worth at least playing around with.
-
+ Confirmed -
- Priority-Medium + Priority-Low + Component-DiffViewer
How about 2.5 years later? This is one of my biggest (current) annoyances with RB, a tool that I otherwise absolutely love.
I'd love to say we have a great algorithm that does the block detection better, but we don't. To do it really well, we need to completely rewrite some things, and add to the amount of processing time it takes, per-diff. It bothers me too, and is on my TODO list, but it's not a matter of a quick patch. There are some large plans to greatly enhance how we process diffs, but it won't happen until after the 2.0 release (which we're working hard on right now).