Commit 5f9d90e2 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge pull request #5958 from brunoga/go-repository-fetch

 Added support for Go's repository retrieval.
parents afd29993 e77694bf
......@@ -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
......
......@@ -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"}
......@@ -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) }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment