]> git.e2factory.org Git - e2factory.git/commitdiff
use generic_git helper functions
authorTobias Ulmer <tu@emlix.com>
Thu, 28 Feb 2019 19:14:17 +0000 (20:14 +0100)
committerTobias Ulmer <tu@emlix.com>
Thu, 28 Feb 2019 19:14:17 +0000 (20:14 +0100)
Signed-off-by: Tobias Ulmer <tu@emlix.com>
generic/generic_git.lua
global/e2-fetch-project.lua
global/e2-install-e2.lua

index 1eceadda3d9d026ce16388de7aeefbf2f07394d0..52aa328ba69a3e1a740e9a23d152577b3b61346a 100644 (file)
@@ -396,7 +396,7 @@ function generic_git.git_init_db1(rurl, shared)
     end
 
     gitdir = e2lib.join("/", u.path);
-    gitargv = { "--git-dir="..gitdir, "init-db" }
+    gitargv = generic_git.git_new_argv(gitdir, false, "init-db")
     if shared then
         table.insert(gitargv, "--shared")
     end
@@ -457,7 +457,7 @@ function generic_git.git_push1(gitdir, rurl, refspec)
         return false, e:cat(re)
     end
 
-    argv = { "--git-dir=" .. gitdir, "push", remote_git_url, refspec }
+    argv = generic_git.git_new_argv(gitdir, nil, "push", remote_git_url, refspec)
     rc, re = generic_git.git(argv)
     if not rc then
         return false, e:cat(re)
@@ -496,8 +496,7 @@ function generic_git.git_remote_add1(lurl, rurl, name)
     end
 
     gitdir = e2lib.join("/", lrepo.path)
-    argv = { "--git-dir="..gitdir, "remote", "add", name, giturl }
-
+    argv = generic_git.git_new_argv(gitdir, nil, "remote", "add", name, giturl)
     rc, re = generic_git.git(argv)
     if not rc then
         return false, re
@@ -837,19 +836,21 @@ function generic_git.new_repository(c, lserver, llocation, rserver, rlocation)
         return false, e:cat(re)
     end
 
-    rc, re = generic_git.git_remote_add(c, lserver, llocation, "origin", rserver, rlocation)
+    rc, re = generic_git.git_remote_add(
+        c, lserver, llocation, generic_git.refs_remote(), rserver, rlocation)
     if not rc then
         return false, e:cat(re)
     end
 
-    argv = { "--git-dir="..gitdir, "config", "branch.master.remote", "origin" }
+    argv = generic_git.git_new_argv(
+        gitdir, nil, "config", "branch.master.remote", generic_git.refs_remote())
     rc, re = generic_git.git(argv)
     if not rc then
         return false, e:cat(re)
     end
 
-    argv = { "--git-dir="..gitdir, "config", "branch.master.merge",
-        refs_heads("master") }
+    argv = generic_git.git_new_argv(
+        gitdir, nil, "config", "branch.master.merge", refs_heads("master"))
     rc, re = generic_git.git(argv)
     if not rc then
         return false, e:cat(re)
index a8be637708883673c8cccf8dab3797a796c0b92b..b2065425aab758df073d818bf3be457e5c2becd7 100644 (file)
@@ -157,13 +157,13 @@ local function e2_fetch_project(arg)
         -- Because the repository is freshly cloned, we can assume that when a
         -- ref for the requested branch exists, HEAD is at that branch.
         rc, re, id = generic_git.lookup_id(e2lib.join(p.destdir, ".git"),
-            false, "refs/heads/" .. p.branch)
+            false, generic_git.refs_heads(p.branch))
         if not rc then
             error(e:cat(re))
         end
         if not id then
             rc, re = generic_git.git_branch_new1(p.destdir, true, p.branch,
-                "origin/" .. p.branch)
+                generic_git.refs_remote_heads(p.branch))
             if not rc then
                 error(e:cat(re))
             end
@@ -188,7 +188,7 @@ local function e2_fetch_project(arg)
             p.tag, p.branch)
         end
 
-        rc, re = generic_git.git_checkout1(p.destdir, "refs/tags/" .. p.tag)
+        rc, re = generic_git.git_checkout1(p.destdir, generic_git.refs_tags(p.tag))
         if not rc then
             error(e:cat(re))
         end
index eb02d1a89f92d7b19b39ebc9373ffcde5217f35e..c27e758e389e8f0fa0ba59a2549caf9072a2a112 100644 (file)
@@ -121,10 +121,10 @@ local function e2_install_e2(arg)
         if e2version.branch:match("/") then
             ref = e2version.branch
         else
-            ref = string.format("remotes/origin/%s", e2version.branch)
+            ref = generic_git.refs_remotes(e2version.branch)
         end
     else
-        ref = string.format("refs/tags/%s", e2version.tag)
+        ref = generic_git.refs_tags(e2version.tag)
     end
 
     -- checkout e2factory itself
@@ -146,7 +146,7 @@ local function e2_install_e2(arg)
 
     for _,ex in ipairs(extensions) do
         if not ex.ref:match("/") then
-            ex.ref = string.format("refs/tags/%s", ex.ref)
+            ex.ref = generic_git.refs_tags(ex.ref)
         end
         e2lib.logf(2, "fetching extension: %s (%s)", ex.name, ex.ref)
         local server = config.site.e2_server