Merge pull request #186 from abf/rosa-build:184-undefined-method-gsub

#184: NoMethodError: undefined method `gsub' for nil:NilClass
This commit is contained in:
avm 2013-06-17 14:28:51 +04:00
commit a6fc975ebf
2 changed files with 10 additions and 5 deletions

View File

@ -5,7 +5,10 @@ module GitHelper
# node.url(treeish) looks like:
# - http://0.0.0.0:3000/abf/git@abf.rosalinux.ru:abf/rhel-scripts.git
# - git://github.com/avokhmin/mdv-scripts.git
url = node.url(treeish).gsub(/.git$/, '')
# - empty string if ".gitmodules" does not exist
url = node.url(treeish)
return nil if url.blank?
url.gsub!(/.git$/, '')
if url =~ /^git:/
url.gsub!(/^git/, 'http')
elsif str = /git@.*:.*/.match(url)

View File

@ -26,10 +26,12 @@
- if node.is_a? Grit::Submodule
.pic= image_tag 'folder-submodule.png'
.name
- url = submodule_url node, @treeish
= link_to(node.name, url, :class => 'files-see')
= '@'
= link_to(node.id[0..6], "#{url}/tree/#{node.id}", :class => 'files-see')
- if url = submodule_url(node, @treeish)
= link_to(node.name, url, :class => 'files-see')
= '@'
= link_to(node.id[0..6], "#{url}/tree/#{node.id}", :class => 'files-see')
- else
= "#{node.name} @ #{node.id[0..6]}"
- else
- options = [@project, @treeish, node_path]
- if node.is_a?(Grit::Tree)