]> git.e2factory.org Git - e2factory.git/commitdiff
Wean e2-create-project off of e2lib.git and use generic_git
authorTobias Ulmer <tu@emlix.com>
Thu, 31 Oct 2013 19:50:00 +0000 (20:50 +0100)
committerTobias Ulmer <tu@emlix.com>
Wed, 16 Nov 2016 14:01:23 +0000 (15:01 +0100)
Signed-off-by: Tobias Ulmer <tu@emlix.com>
global/e2-create-project.lua

index 325a2d6ad5e9c12900a779284c56c30a7ce89aab..eb8df70af999969279d85f112c0c4b4ba465ed8a 100644 (file)
@@ -35,6 +35,7 @@ local generic_git = require("generic_git")
 local err = require("err")
 local e2option = require("e2option")
 local buildconfig = require("buildconfig")
+local url = require("url")
 
 --- Create a extensions config.
 -- @param extensions Table.
@@ -206,8 +207,18 @@ local function e2_create_project(arg)
     -- works up to this point
 
     -- create the initial (git) repository
-    local url = string.format("file://%s/.git", tmpdir)
-    rc, re = e2lib.git(nil, "init-db")
+    local tmp_repo_url, tmp_repo_path
+
+    tmp_repo_url, re = url.parse(string.format("file://%s/.git", tmpdir))
+    if not tmp_repo_url then
+        return false, e:cat(re)
+    end
+    tmp_repo_path, re = url.to_file_path(tmp_repo_url)
+    if not tmp_repo_path then
+        return false, e:cat(re)
+    end
+
+    rc, re = generic_git.git_init_db1(tmp_repo_url.url, false)
     if not rc then
         return false, e:cat(re)
     end
@@ -265,7 +276,7 @@ local function e2_create_project(arg)
         if not rc then
             return false, e:cat(re)
         end
-        rc, re = e2lib.git(nil, "add", f.filename)
+        rc, re = generic_git.git_add(tmp_repo_path, { f.filename })
         if not rc then
             return false, e:cat(re)
         end
@@ -274,18 +285,20 @@ local function e2_create_project(arg)
     if not rc then
         return false, e:cat(re)
     end
-    rc, re = e2lib.git(nil, "add", e2lib.globals.extension_config)
+    rc, re = generic_git.git_add(tmp_repo_path,
+        { e2lib.globals.extension_config })
     if not rc then
         return false, e:cat(re)
     end
-    rc, re = e2lib.git(nil, "commit", "-m \"project setup\"")
+    rc, re = generic_git.git_commit(tmp_repo_path, { "-m", "project setup" })
     if not rc then
         return false, e:cat(re)
     end
 
     local refspec = "master:refs/heads/master"
     local rlocation = string.format("%s/proj/%s.git", p.location, p.name)
-    rc, re = generic_git.git_push(scache, ".git", p.server, rlocation, refspec)
+    rc, re = generic_git.git_push(scache, tmp_repo_path, p.server,
+        rlocation, refspec)
     if not rc then
         return false, e:cat(re)
     end