From 9393809066c10d1568e75372a8c99c3a67bed489 Mon Sep 17 00:00:00 2001
From: Bruno Albuquerque <bga@bug-br.org.br>
Date: Mon, 30 Dec 2013 15:14:15 -0500
Subject: [PATCH] Use project methods instead of attributes.

- This should work correctly in all cases now.
- Added a new project method that returns the web url for a project without
  the scheme prefix.
---
 app/models/project.rb             | 4 ++++
 app/views/layouts/_head.html.haml | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/app/models/project.rb b/app/models/project.rb
index a55f7a65b0b..1384165231c 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -201,6 +201,10 @@ class Project < ActiveRecord::Base
     [Gitlab.config.gitlab.url, path_with_namespace].join("/")
   end
 
+  def web_url_without_scheme
+    [Gitlab.config.gitlab.host, path_with_namespace].join("/")
+  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 d4ac9287202..97f7e343fad 100644
--- a/app/views/layouts/_head.html.haml
+++ b/app/views/layouts/_head.html.haml
@@ -3,7 +3,7 @@
 
   -# Go repository retrieval support.
   - if controller_name == 'projects' && action_name == 'show'
-    %meta{name: "go-import", content: "#{Gitlab.config.gitlab.host}/#{@project.namespace.path}/#{@project.path} git http://#{Gitlab.config.gitlab.host}/#{@project.namespace.path}/#{@project.path}.git"}
+    %meta{name: "go-import", content: "#{@project.web_url_without_scheme} git #{@project.web_url}.git"}
 
   %title
     = "#{title} | " if defined?(title)
-- 
GitLab