Project

General

Profile

Feature #1948 » git-submodule-view.patch

Bastian Lüttig, 2018-02-28 16:10

View differences:

app/views/repositories/_dir_list_content.html.erb
16 16
                       :depth  => (depth + 1),
17 17
                       :parent_id => tr_id)) %>');">&nbsp;</span>
18 18
<% end %>
19
<% if entry.is_submodule? %>
20
<%=  link_to ent_name,
21
          {:id => @project, :repository_id => ent_name, :rev => ent_path },
22
          :class => "icon icon-shared"
23
%>
24
<% else %>
19 25
<%=  link_to ent_name,
20 26
          {:action => (entry.is_dir? ? 'show' : 'entry'), :id => @project, :repository_id => @repository.identifier_param, :path => to_path_param(ent_path), :rev => @rev},
21 27
          :class => (entry.is_dir? ? 'icon icon-folder' : "icon icon-file #{Redmine::MimeType.css_class_of(ent_name)}")%>
28
<% end %>
22 29
</td>
23 30
<td class="size"><%= (entry.size ? number_to_human_size(entry.size) : "?") unless entry.is_dir? %></td>
24 31
<% if @repository.report_last_commit %>
lib/redmine/scm/adapters/abstract_adapter.rb
331 331
          'file' == self.kind
332 332
        end
333 333

  
334
        def is_submodule?
335
          'submodule' == self.kind
336
        end
337

  
334 338
        def is_dir?
335 339
          'dir' == self.kind
336 340
        end
lib/redmine/scm/adapters/git_adapter.rb
148 148
                full_path = p.empty? ? name : "#{p}/#{name}"
149 149
                n      = scm_iconv('UTF-8', @path_encoding, name)
150 150
                full_p = scm_iconv('UTF-8', @path_encoding, full_path)
151
		if type == "tree"
152
			kind = 'dir'
153
		elsif type == "commit"
154
			kind = 'submodule'
155
			full_p = sha
156
		else
157
			kind = 'file'
158
		end
151 159
                entries << Entry.new({:name => n,
152 160
                 :path => full_p,
153
                 :kind => (type == "tree") ? 'dir' : 'file',
161
                 :kind => kind,
154 162
                 :size => (type == "tree") ? nil : size,
155 163
                 :lastrev => options[:report_last_commit] ?
156 164
                                 lastrev(full_path, identifier) : Revision.new
    (1-1/1)