diff options
-rw-r--r-- | app/models/project.rb | 4 | ||||
-rw-r--r-- | app/views/layouts/_head.html.haml | 5 | ||||
-rw-r--r-- | spec/models/project_spec.rb | 5 |
3 files changed, 14 insertions, 0 deletions
diff --git a/app/models/project.rb b/app/models/project.rb index 30faaf00fff..da5f25f3cbc 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -205,6 +205,10 @@ class Project < ActiveRecord::Base [Gitlab.config.gitlab.url, path_with_namespace].join("/") end + def web_url_without_protocol + web_url.split("://")[1] + end + def build_commit_note(commit) notes.new(commit_id: commit.id, noteable_type: "Commit") end diff --git a/app/views/layouts/_head.html.haml b/app/views/layouts/_head.html.haml index 68146e661eb..5723250151a 100644 --- a/app/views/layouts/_head.html.haml +++ b/app/views/layouts/_head.html.haml @@ -22,3 +22,8 @@ = 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}") - if current_controller?(:issues) = auto_discovery_link_tag(:atom, project_issues_url(@project, :atom, private_token: current_user.private_token), title: "#{@project.name} issues") + + -# Go repository retrieval support. + - if controller_name == 'projects' && action_name == 'show' + %meta{name: "go-import", content: "#{@project.web_url_without_protocol} git #{@project.web_url}.git"} + diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb index 8aa4c7fed1a..373accfe412 100644 --- a/spec/models/project_spec.rb +++ b/spec/models/project_spec.rb @@ -99,6 +99,11 @@ describe Project do project.web_url.should == "#{Gitlab.config.gitlab.url}/somewhere" end + it "returns the web URL without the protocol for this repo" do + project = Project.new(path: "somewhere") + project.web_url_without_protocol.should == "#{Gitlab.config.gitlab.host}/somewhere" + end + describe "last_activity methods" do let(:project) { create(:project) } let(:last_event) { double(created_at: Time.now) } |