]> git.e2factory.org Git - e2factory.git/commitdiff
Move git.git_remote_add() to generic_git module
authorTobias Ulmer <tu@emlix.com>
Wed, 22 Aug 2012 14:27:40 +0000 (16:27 +0200)
committerTobias Ulmer <tu@emlix.com>
Tue, 26 Feb 2013 18:07:07 +0000 (19:07 +0100)
Signed-off-by: Tobias Ulmer <tu@emlix.com>
generic/generic_git.lua

index b18f7e68075e2212b3ac9299205a03c1a68b5ef7..49e7f6a2bbc79e7ba398bffa32c49f2e46ee7e6c 100644 (file)
@@ -245,6 +245,25 @@ function generic_git.git_remote_add1(lurl, rurl, name)
     return true, nil
 end
 
+function generic_git.git_remote_add(c, lserver, llocation, name, rserver, rlocation)
+    e2lib.log(4, string.format("%s, %s, %s, %s, %s, %s",
+    tostring(c), tostring(lserver), tostring(llocation),
+    tostring(name), tostring(rserver), tostring(rlocation)))
+    local rurl, e = cache.remote_url(c, rserver, rlocation)
+    if not rurl then
+        e2lib.abort(e)
+    end
+    local lurl, e = cache.remote_url(c, lserver, llocation)
+    if not lurl then
+        e2lib.abort(e)
+    end
+    local rc, e = generic_git.git_remote_add1(lurl, rurl, name)
+    if not rc then
+        e2lib.abort(e)
+    end
+    return true, nil
+end
+
 --- translate a url to a git url
 -- @param u url table
 -- @return string: the git url
@@ -576,7 +595,7 @@ function generic_git.new_repository(c, lserver, llocation, rserver, rlocation, f
     if not rc then
         return false, e:cat("can't initialize local git repository")
     end
-    rc = git.git_remote_add(c, lserver, llocation, "origin",
+    rc = generic_git.git_remote_add(c, lserver, llocation, "origin",
     rserver, rlocation)
     if not rc then
         return false, e:cat("git remote add failed")