#184: not show link when submodule does not exist
This commit is contained in:
parent
a835f3b45e
commit
e36a0386a2
|
@ -5,7 +5,8 @@ module GitHelper
|
||||||
# node.url(treeish) looks like:
|
# node.url(treeish) looks like:
|
||||||
# - http://0.0.0.0:3000/abf/git@abf.rosalinux.ru:abf/rhel-scripts.git
|
# - http://0.0.0.0:3000/abf/git@abf.rosalinux.ru:abf/rhel-scripts.git
|
||||||
# - git://github.com/avokhmin/mdv-scripts.git
|
# - git://github.com/avokhmin/mdv-scripts.git
|
||||||
url = node.url(treeish).gsub(/.git$/, '')
|
return nil unless url = node.url(treeish)
|
||||||
|
url.gsub!(/.git$/, '')
|
||||||
if url =~ /^git:/
|
if url =~ /^git:/
|
||||||
url.gsub!(/^git/, 'http')
|
url.gsub!(/^git/, 'http')
|
||||||
elsif str = /git@.*:.*/.match(url)
|
elsif str = /git@.*:.*/.match(url)
|
||||||
|
|
|
@ -26,10 +26,12 @@
|
||||||
- if node.is_a? Grit::Submodule
|
- if node.is_a? Grit::Submodule
|
||||||
.pic= image_tag 'folder-submodule.png'
|
.pic= image_tag 'folder-submodule.png'
|
||||||
.name
|
.name
|
||||||
- url = submodule_url node, @treeish
|
- if url = submodule_url(node, @treeish)
|
||||||
= link_to(node.name, url, :class => 'files-see')
|
= link_to(node.name, url, :class => 'files-see')
|
||||||
= '@'
|
= '@'
|
||||||
= link_to(node.id[0..6], "#{url}/tree/#{node.id}", :class => 'files-see')
|
= link_to(node.id[0..6], "#{url}/tree/#{node.id}", :class => 'files-see')
|
||||||
|
- else
|
||||||
|
= "#{node.name} @ #{node.id[0..6]}"
|
||||||
- else
|
- else
|
||||||
- options = [@project, @treeish, node_path]
|
- options = [@project, @treeish, node_path]
|
||||||
- if node.is_a?(Grit::Tree)
|
- if node.is_a?(Grit::Tree)
|
||||||
|
|
Loading…
Reference in New Issue