]> git.e2factory.org Git - e2factory.git/commitdiff
git: commitid and empty branch are not yet ready
authorTobias Ulmer <tu@emlix.com>
Fri, 3 May 2019 17:16:50 +0000 (19:16 +0200)
committerTobias Ulmer <tu@emlix.com>
Fri, 3 May 2019 17:16:50 +0000 (19:16 +0200)
Signed-off-by: Tobias Ulmer <tu@emlix.com>
plugins/git.lua

index 90843c56deb6683fe994fe0f82e99fb7ba68106a..1454603e6b7384d234405bea526741b751a86dcd 100644 (file)
@@ -72,6 +72,7 @@ function git.git_source:initialize(rawsrc)
         ["working-copy"] = "working-copy",
     }
     self._commitids = {}
+    self._xxxcommitid = false -- XXX: Not yet
 
     rc, re = e2lib.vrfy_dict_exp_keys(rawsrc, "e2source", {
         "branch",
@@ -111,7 +112,7 @@ function git.git_source:initialize(rawsrc)
     self._working = rawsrc.working
 
     for _,attr in ipairs({ "branch", "location", "tag" }) do
-        if rawsrc[attr] == nil then
+        if --[[attr ~= "branch" and]] rawsrc[attr] == nil then
             error(err.new("source has no `%s' attribute", attr))
         elseif type(rawsrc[attr]) ~= "string" then
             error(err.new("'%s' must be a string", attr))
@@ -120,7 +121,7 @@ function git.git_source:initialize(rawsrc)
         end
     end
 
-    self._branch = rawsrc.branch
+    self._branch = rawsrc.branch or ""
     self._location = rawsrc.location
     self._tag = rawsrc.tag
 end
@@ -329,8 +330,13 @@ function git.git_source:display()
     end
     local d = {}
     table.insert(d, string.format("type       = %s", self:get_type()))
-    table.insert(d, string.format("branch     = %-15s %s", self._branch, rev_branch))
+    if self._branch ~= "" then
+        table.insert(d, string.format("branch     = %-15s %s", self._branch, rev_branch))
+    end
     table.insert(d, string.format("tag        = %-15s %s", self._tag, rev_tag))
+    if self._xxxcommitid then
+        table.insert(d, string.format("commitid   = %s", self._xxxcommitid))
+    end
     table.insert(d, string.format("server     = %s", self._server))
     table.insert(d, string.format("location   = %s", self._location))
     table.insert(d, string.format("working    = %s", self:get_working()))