Project

General

Profile

Actions

Defect #9143

closed

Partial diff comparison should be done on actual code, not on html

Added by Isaac Betesh about 13 years ago. Updated over 12 years ago.

Status:
Closed
Priority:
Normal
Category:
SCM
Target version:
Start date:
2011-08-29
Due date:
% Done:

0%

Estimated time:
Resolution:
Fixed
Affected version:

Description

Semicolons were mysteriously appearing in code diffs in the repository, but only when viewed in Redmine. Upon investigation, it became clear that this is because the semicolon was not part of the diff, but was just after it. Since part of the line that changed is enclosed in <span> tags, when the change ends in the old and new versions with distinct HTML special chars, the semicolon terminating the special chars is treated as if it hadn't changed.
Observe, in the example below, how > and & should each be treated as a single unit, but is instead handled one char at a time, making it appear that "&gt" became "&amp" and that the ";" didn't change.

<tr> 
  <th class="line-num">47</th> 
  <th class="line-num"></th> 
  <td class="line-code diff_out"> 
    <pre>void DoSomething(<span>std::auto_ptr&lt;MyClass&gt</span>; myObj)
</pre> 
  </td> 
</tr> 

<tr> 
  <th class="line-num"></th> 
  <th class="line-num">47</th> 
  <td class="line-code diff_in"> 
    <pre>void DoSomething(<span>const MyClass&amp</span>; myObj)
</pre> 
  </td> 
</tr>

I suspect this is a result of the fact that the code in the repository is first rendered as html, and then passed to the engine that analyzes where the changes are. This should be done in the opposite order.


Related issues

Related to Redmine - Feature #2371: character encoding for attachment fileClosedToshi MARUYAMA2008-12-22

Actions
Has duplicate Redmine - Defect #9440: Escaping issue with inline diff-highlighting in revision diff viewClosed2011-10-20

Actions
Actions

Also available in: Atom PDF