Commit edd95a0e74eecf88858e0806057df6cb003ab046

Authored by Dmitriy Zaporozhets
2 parents 1d2af745 5f9d90e2

Merge branch 'master' of github.com:gitlabhq/gitlabhq

app/models/project.rb
@@ -205,6 +205,10 @@ class Project < ActiveRecord::Base @@ -205,6 +205,10 @@ class Project < ActiveRecord::Base
205 [Gitlab.config.gitlab.url, path_with_namespace].join("/") 205 [Gitlab.config.gitlab.url, path_with_namespace].join("/")
206 end 206 end
207 207
  208 + def web_url_without_protocol
  209 + web_url.split("://")[1]
  210 + end
  211 +
208 def build_commit_note(commit) 212 def build_commit_note(commit)
209 notes.new(commit_id: commit.id, noteable_type: "Commit") 213 notes.new(commit_id: commit.id, noteable_type: "Commit")
210 end 214 end
app/views/layouts/_head.html.haml
@@ -22,3 +22,8 @@ @@ -22,3 +22,8 @@
22 = auto_discovery_link_tag(:atom, project_commits_url(@project, @ref, format: :atom, private_token: current_user.private_token), title: "Recent commits to #{@project.name}:#{@ref}") 22 = auto_discovery_link_tag(:atom, project_commits_url(@project, @ref, format: :atom, private_token: current_user.private_token), title: "Recent commits to #{@project.name}:#{@ref}")
23 - if current_controller?(:issues) 23 - if current_controller?(:issues)
24 = auto_discovery_link_tag(:atom, project_issues_url(@project, :atom, private_token: current_user.private_token), title: "#{@project.name} issues") 24 = auto_discovery_link_tag(:atom, project_issues_url(@project, :atom, private_token: current_user.private_token), title: "#{@project.name} issues")
  25 +
  26 + -# Go repository retrieval support.
  27 + - if controller_name == 'projects' && action_name == 'show'
  28 + %meta{name: "go-import", content: "#{@project.web_url_without_protocol} git #{@project.web_url}.git"}
  29 +
spec/models/project_spec.rb
@@ -99,6 +99,11 @@ describe Project do @@ -99,6 +99,11 @@ describe Project do
99 project.web_url.should == "#{Gitlab.config.gitlab.url}/somewhere" 99 project.web_url.should == "#{Gitlab.config.gitlab.url}/somewhere"
100 end 100 end
101 101
  102 + it "returns the web URL without the protocol for this repo" do
  103 + project = Project.new(path: "somewhere")
  104 + project.web_url_without_protocol.should == "#{Gitlab.config.gitlab.host}/somewhere"
  105 + end
  106 +
102 describe "last_activity methods" do 107 describe "last_activity methods" do
103 let(:project) { create(:project) } 108 let(:project) { create(:project) }
104 let(:last_event) { double(created_at: Time.now) } 109 let(:last_event) { double(created_at: Time.now) }