5416: Do not override git urls for remote hosted repos.
[arvados.git] / services / api / app / models / repository.rb
index 0cab4dcf8760641b95f7eb8f3c5dfa2b05d11018..e83ac41fad7b4bcb55eab7aec5f5bbdc8d47ae73 100644 (file)
@@ -20,7 +20,12 @@ class Repository < ArvadosModel
   end
 
   def push_url
-    "git@git.%s.arvadosapi.com:%s.git" % [Rails.configuration.uuid_prefix, name]
+    prefix = new_record? ? Rails.configuration.uuid_prefix : uuid[0,5]
+    if prefix == Rails.configuration.uuid_prefix
+      host = Rails.configuration.git_host
+    end
+    host ||= "git.%s.arvadosapi.com" % prefix
+    "git@%s:%s.git" % [host, name]
   end
 
   def fetch_url