From: Sascha Peilicke
Deleted files aren't available in the diff source but in the diff
target. The 'sourcediff' view currently doesn't take the target as
parameter, thus the deleted file is taken from source_revision - 1. This
is a bit hacky but works. A saner solution would be to pass the diff
target revision to the 'sourcediff' partial but that would complicate
the 'render :partial => ...' line quite a bit without too much win.
---
src/webui/app/views/shared/_sourcediff.html.erb | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/src/webui/app/views/shared/_sourcediff.html.erb b/src/webui/app/views/shared/_sourcediff.html.erb
index d1e13cb..2edbcb1 100644
--- a/src/webui/app/views/shared/_sourcediff.html.erb
+++ b/src/webui/app/views/shared/_sourcediff.html.erb
@@ -70,8 +70,11 @@
</td>
<td><%= file_element.value('state').capitalize %></td>
<td>
+ <%# NOTE: Currently rather crude hack, deleted files aren't available in current source revision, thus use previous: %>
+ <% rev = source[:rev] %>
+ <% rev = (rev.to_i - 1).to_s if file_element.state == 'deleted' %>
<%# TODO: drop this check for '/' once we can 'view' files inside tarballs: %>
- <%= link_to_unless(is_binary(filename) || filename.include?('/'), filename, :controller => 'package', :action => 'view_file', :project => source[:project], :package => source[:package], :file => filename, :rev => source[:rev]) %>
+ <%= link_to_unless(is_binary(filename) || filename.include?('/'), filename, :controller => 'package', :action => 'view_file', :project => source[:project], :package => source[:package], :file => filename, :rev => rev) %>
</td>
</tr>
<% if file_diff_text.length > 0 %>
--
1.7.7
--
To unsubscribe, e-mail: obs-commits+unsubscribe@opensuse.org
To contact the owner, e-mail: obs-commits+owner@opensuse.org