diff --git a/app/views/repositories/_dir_list_content.html.erb b/app/views/repositories/_dir_list_content.html.erb index f78073b0c..cc69f1edd 100644 --- a/app/views/repositories/_dir_list_content.html.erb +++ b/app/views/repositories/_dir_list_content.html.erb @@ -16,9 +16,16 @@ :depth => (depth + 1), :parent_id => tr_id)) %>');">  <% end %> +<% if entry.is_submodule? %> +<%= link_to ent_name, + {:id => @project, :repository_id => ent_name, :rev => ent_path }, + :class => "icon icon-shared" +%> +<% else %> <%= link_to ent_name, {:action => (entry.is_dir? ? 'show' : 'entry'), :id => @project, :repository_id => @repository.identifier_param, :path => to_path_param(ent_path), :rev => @rev}, :class => (entry.is_dir? ? 'icon icon-folder' : "icon icon-file #{Redmine::MimeType.css_class_of(ent_name)}")%> +<% end %> <%= (entry.size ? number_to_human_size(entry.size) : "?") unless entry.is_dir? %> <% if @repository.report_last_commit %> diff --git a/lib/redmine/scm/adapters/abstract_adapter.rb b/lib/redmine/scm/adapters/abstract_adapter.rb index 437ba92a8..193b23012 100644 --- a/lib/redmine/scm/adapters/abstract_adapter.rb +++ b/lib/redmine/scm/adapters/abstract_adapter.rb @@ -331,6 +331,10 @@ module Redmine 'file' == self.kind end + def is_submodule? + 'submodule' == self.kind + end + def is_dir? 'dir' == self.kind end diff --git a/lib/redmine/scm/adapters/git_adapter.rb b/lib/redmine/scm/adapters/git_adapter.rb index fcc77f393..c947556b9 100644 --- a/lib/redmine/scm/adapters/git_adapter.rb +++ b/lib/redmine/scm/adapters/git_adapter.rb @@ -148,9 +148,17 @@ module Redmine full_path = p.empty? ? name : "#{p}/#{name}" n = scm_iconv('UTF-8', @path_encoding, name) full_p = scm_iconv('UTF-8', @path_encoding, full_path) + if type == "tree" + kind = 'dir' + elsif type == "commit" + kind = 'submodule' + full_p = sha + else + kind = 'file' + end entries << Entry.new({:name => n, :path => full_p, - :kind => (type == "tree") ? 'dir' : 'file', + :kind => kind, :size => (type == "tree") ? nil : size, :lastrev => options[:report_last_commit] ? lastrev(full_path, identifier) : Revision.new