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 {
|
||||||
width: 130px;
|
|
||||||
/*padding-left: 17px;*/
|
|
||||||
}
|
|
||||||
|
|
||||||
table.tablesorter.project .th2 {
|
.th1 {
|
||||||
width: 110px;
|
width: 130px;
|
||||||
/*padding-left: 17px;*/
|
/*padding-left: 17px;*/
|
||||||
}
|
}
|
||||||
|
.th2 {
|
||||||
table.tablesorter.project .th3 {
|
width: 110px;
|
||||||
width: 450px;
|
/*padding-left: 17px;*/
|
||||||
}
|
}
|
||||||
|
.th3 {
|
||||||
table.tablesorter.project .th4 {
|
width: 450px;
|
||||||
/*padding-left: 17px;*/
|
}
|
||||||
}
|
.th4 {
|
||||||
|
/*padding-left: 17px;*/
|
||||||
table.tablesorter.project div.name {
|
}
|
||||||
float: left;
|
.name {
|
||||||
margin-top: 0px;
|
float: left;
|
||||||
}
|
margin-top: 0px;
|
||||||
|
}
|
||||||
table.tablesorter.project div.pic {
|
.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)
|
||||||
%td
|
- pic = 'folder.png'
|
||||||
%span{:style => "display: none;"}= date = commit.committed_date || commit.authored_date
|
- path = tree_path *options
|
||||||
= l(date, :format => :short)
|
.pic= image_tag pic || 'code.png'
|
||||||
%td= commit.short_message
|
.name= link_to(node.name, path || blob_path(*options), :class => 'files-see')
|
||||||
%td= (commit.committer || commit.author).name
|
|
||||||
|
- if commit
|
||||||
|
%td
|
||||||
|
%span{:style => "display: none;"}= date = commit.committed_date || commit.authored_date
|
||||||
|
= l(date, :format => :short)
|
||||||
|
%td= commit.short_message
|
||||||
|
%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