summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-01-21 12:27:39 +0200
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-01-21 12:27:39 +0200
commitedd95a0e74eecf88858e0806057df6cb003ab046 (patch)
tree443a1f6c96634a8bba9ebba61616a97e3bcb171d
parent1d2af74578a8133866b1a19caf0f2003eeaa7096 (diff)
parent5f9d90e2186c373d336794fa336496652a638366 (diff)
downloadgitlab-ce-edd95a0e74eecf88858e0806057df6cb003ab046.tar.gz
Merge branch 'master' of github.com:gitlabhq/gitlabhq
-rw-r--r--app/models/project.rb4
-rw-r--r--app/views/layouts/_head.html.haml5
-rw-r--r--spec/models/project_spec.rb5
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) }