From c0744e5ba07a16475b014b976664c729c59516b7 Mon Sep 17 00:00:00 2001
From: Timm Drevensek <abubadabu@gmail.com>
Date: Fri, 28 Feb 2014 17:22:07 +0100
Subject: [PATCH] simplify link url

---
 app/helpers/submodule_helper.rb | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/app/helpers/submodule_helper.rb b/app/helpers/submodule_helper.rb
index d7a253fac89..09e5c08e621 100755
--- a/app/helpers/submodule_helper.rb
+++ b/app/helpers/submodule_helper.rb
@@ -50,11 +50,10 @@ module SubmoduleHelper
 
   def relative_self_links(url, commit)
     if url.scan(/(\.\.\/)/).size == 2
-      base = [ Gitlab.config.gitlab.url, '/', url[/.*\/(.*)\/.*\.git/, 1] ].join('')
+      base = url[/([^\/]*\/[^\/]*)\.git/, 1]
     else
-      base = [ Gitlab.config.gitlab.url, '/', @project.group.path ].join('')
+      base = [ @project.group.path, '/', url[/([^\/]*)\.git/, 1] ].join('')
     end
-    base = [ base, '/', url[/.*\/(.*)\.git/, 1] ].join('')
-    return base, [ base, '/tree/', commit ].join('')
+    return project_path(base), project_tree_path(base, commit)
   end
 end
-- 
GitLab