Merge pull request #94 from abf/rosa-build:93-support-git-submodule
#93: Support git submodule
This commit is contained in:
commit
8fdcb33a83
Binary file not shown.
After Width: | Height: | Size: 3.2 KiB |
|
@ -2019,3 +2019,10 @@ article .activity .top {
|
||||||
.cm-s-default.md_and_cm p img {
|
.cm-s-default.md_and_cm p img {
|
||||||
max-width: 800px;
|
max-width: 800px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.tablesorter.project {
|
||||||
|
.th1 {
|
||||||
|
width: auto;
|
||||||
|
}
|
||||||
|
th { text-align: center; }
|
||||||
|
}
|
|
@ -1514,32 +1514,30 @@ div.fork p {
|
||||||
|
|
||||||
/* Project main page */
|
/* Project main page */
|
||||||
|
|
||||||
table.tablesorter.project .th1 {
|
.tablesorter.project {
|
||||||
|
|
||||||
|
.th1 {
|
||||||
width: 130px;
|
width: 130px;
|
||||||
/*padding-left: 17px;*/
|
/*padding-left: 17px;*/
|
||||||
}
|
}
|
||||||
|
.th2 {
|
||||||
table.tablesorter.project .th2 {
|
|
||||||
width: 110px;
|
width: 110px;
|
||||||
/*padding-left: 17px;*/
|
/*padding-left: 17px;*/
|
||||||
}
|
}
|
||||||
|
.th3 {
|
||||||
table.tablesorter.project .th3 {
|
|
||||||
width: 450px;
|
width: 450px;
|
||||||
}
|
}
|
||||||
|
.th4 {
|
||||||
table.tablesorter.project .th4 {
|
|
||||||
/*padding-left: 17px;*/
|
/*padding-left: 17px;*/
|
||||||
}
|
}
|
||||||
|
.name {
|
||||||
table.tablesorter.project div.name {
|
|
||||||
float: left;
|
float: left;
|
||||||
margin-top: 0px;
|
margin-top: 0px;
|
||||||
}
|
}
|
||||||
|
.pic {
|
||||||
table.tablesorter.project div.pic {
|
|
||||||
float: left;
|
float: left;
|
||||||
padding-right: 5px;
|
padding-right: 5px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
a.files-see {
|
a.files-see {
|
||||||
|
|
|
@ -20,18 +20,31 @@
|
||||||
%td==
|
%td==
|
||||||
%td==
|
%td==
|
||||||
%td==
|
%td==
|
||||||
- @project.tree_info(@tree, @treeish, @path).each_pair do |entry, commit|
|
- @project.tree_info(@tree, @treeish, @path).each do |node, node_path, commit|
|
||||||
%tr
|
%tr
|
||||||
%td
|
%td
|
||||||
- entry_path = File.join([@path.present? ? @path : nil, entry.name].compact)
|
- if node.is_a? Grit::Submodule
|
||||||
- if entry.is_a? Grit::Blob
|
.pic= image_tag 'folder-submodule.png'
|
||||||
.pic= image_tag 'code.png'
|
.name
|
||||||
.name= link_to(entry.name, blob_path(@project, @treeish, entry_path), :class => 'files-see')
|
- url = node.url(@treeish).gsub(/^git/, 'http').gsub(/.git$/, '')
|
||||||
|
= link_to(node.name, url, :class => 'files-see')
|
||||||
|
= '@'
|
||||||
|
= link_to(node.id[0..6], "#{url}/tree/#{node.id}", :class => 'files-see')
|
||||||
- else
|
- else
|
||||||
.pic= image_tag 'folder.png'
|
- options = [@project, @treeish, node_path]
|
||||||
.name= link_to(entry.name, tree_path(@project, @treeish, entry_path), :class => 'files-see')
|
- if node.is_a?(Grit::Tree)
|
||||||
|
- pic = 'folder.png'
|
||||||
|
- path = tree_path *options
|
||||||
|
.pic= image_tag pic || 'code.png'
|
||||||
|
.name= link_to(node.name, path || blob_path(*options), :class => 'files-see')
|
||||||
|
|
||||||
|
- if commit
|
||||||
%td
|
%td
|
||||||
%span{:style => "display: none;"}= date = commit.committed_date || commit.authored_date
|
%span{:style => "display: none;"}= date = commit.committed_date || commit.authored_date
|
||||||
= l(date, :format => :short)
|
= l(date, :format => :short)
|
||||||
%td= commit.short_message
|
%td= commit.short_message
|
||||||
%td= (commit.committer || commit.author).name
|
%td= (commit.committer || commit.author).name
|
||||||
|
- else
|
||||||
|
%td
|
||||||
|
%td
|
||||||
|
%td
|
||||||
|
|
|
@ -70,24 +70,18 @@ module Modules
|
||||||
end
|
end
|
||||||
|
|
||||||
def tree_info(tree, treeish = nil, path = nil)
|
def tree_info(tree, treeish = nil, path = nil)
|
||||||
treeish ||= tree.id
|
grouped = tree.contents.sort_by{|c| c.name.downcase}.group_by(&:class)
|
||||||
# initialize result as hash of <tree_entry> => nil
|
[
|
||||||
res = (tree.trees.sort + tree.blobs.sort).inject({}){|h, e| h.merge!({e => nil})}
|
grouped[Grit::Tree],
|
||||||
# fills result vith commits that describes this file
|
grouped[Grit::Blob],
|
||||||
res = res.inject(res) do |h, (entry, commit)|
|
grouped[Grit::Submodule]
|
||||||
if commit.nil? and entry.respond_to?(:name) # only if commit == nil
|
].compact.flatten.map do |node|
|
||||||
# ... find last commit corresponds to this file ...
|
node_path = File.join([path.present? ? path : nil, node.name].compact)
|
||||||
c = repo.log(treeish, File.join([path, entry.name].compact), :max_count => 1).first
|
[
|
||||||
# ... and add it to result.
|
node,
|
||||||
h[entry] = c
|
node_path,
|
||||||
# find another files, that linked to this commit and set them their commit
|
repo.log(treeish, node_path, :max_count => 1).first
|
||||||
# c.diffs.map{|diff| diff.b_path.split(File::SEPARATOR, 2).first}.each do |name|
|
]
|
||||||
# h.each_pair do |k, v|
|
|
||||||
# h[k] = c if k.name == name and v.nil?
|
|
||||||
# end
|
|
||||||
# end
|
|
||||||
end
|
|
||||||
h
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue