diff --git a/app/views/wiki/annotate.html.erb b/app/views/wiki/annotate.html.erb
index 950a5a77c..1b48f5db8 100644
--- a/app/views/wiki/annotate.html.erb
+++ b/app/views/wiki/annotate.html.erb
@@ -20,17 +20,17 @@
-<% line_num = 1 %>
+<% line_num = 1; prev_version = nil %>
<% @annotate.lines.each do |line| -%>
| <%= line_num %> |
<%= link_to line[0], :controller => 'wiki',
:action => 'show', :project_id => @project,
- :id => @page.title, :version => line[0] %> |
- <%= line[1] %> |
+ :id => @page.title, :version => line[0] unless prev_version == line[0] %>
+ <%= line[1] unless prev_version == line[0] %> |
<%= line[2] %> |
-<% line_num += 1 %>
+<% line_num += 1; prev_version = line[0] %>
<% end -%>
diff --git a/test/functional/wiki_controller_test.rb b/test/functional/wiki_controller_test.rb
index 193efb0b7..c0a169d7b 100644
--- a/test/functional/wiki_controller_test.rb
+++ b/test/functional/wiki_controller_test.rb
@@ -702,11 +702,10 @@ class WikiControllerTest < Redmine::ControllerTest
assert_select 'td', :text => /h1\. CookBook documentation v2/
end
- # Line 4
- assert_select 'table.annotate tr:nth-child(4)' do
- assert_select 'th.line-num', :text => '4'
+ # Line 2
+ assert_select 'table.annotate tr:nth-child(2)' do
+ assert_select 'th.line-num', :text => '2'
assert_select 'td.author', :text => /John Smith/
- assert_select 'td', :text => /Line from v1/
end
# Line 5