]> git.e2factory.org Git - e2factory.git/commitdiff
generic_git: remove mostly unused sourceset2ref() helper
authorTobias Ulmer <tu@emlix.com>
Thu, 2 Feb 2017 14:49:10 +0000 (15:49 +0100)
committerTobias Ulmer <tu@emlix.com>
Thu, 2 Feb 2017 14:49:10 +0000 (15:49 +0100)
Signed-off-by: Tobias Ulmer <tu@emlix.com>
generic/generic_git.lua
plugins/git.lua

index 2eae8a3006c22f5ba2256d357882f0743193d90f..6a5b2b2cd002c1d67bc118dc2a51d0593706c2bc 100644 (file)
@@ -749,23 +749,6 @@ function generic_git.verify_head_match_tag(gitwc, verify_tag)
     return true
 end
 
---- Translate sourceset, branch and tag into a git ref.
--- @param sourceset Source setting.
--- @param branch Source branch.
--- @param tag Source tag.
--- @return git refs string, or false on error.
--- @return Error object on failure.
-function generic_git.sourceset2ref(sourceset, branch, tag)
-    if sourceset == "branch" then
-        return string.format("refs/heads/%s", branch)
-    elseif sourceset == "tag" then
-        return string.format("refs/tags/%s", tag)
-    end
-
-    return false, err.new("not a valid sourceset combination: %q %q %q",
-        sourceset, branch, tag)
-end
-
 --- Create a new git source repository.
 -- @param c cache table
 -- @param lserver string: local server
index ae3184a17dbc002853058c4bf42a45b1337bf583..396d007d50e0dd27267a12ccf946df1e32142041 100644 (file)
@@ -687,9 +687,10 @@ local function git_to_result(src, sourceset, directory)
     if sourceset == "tag" or sourceset == "branch" then
         local ref, tmpfn
 
-        ref, re = generic_git.sourceset2ref(sourceset, src:get_branch(), src:get_tag())
-        if not ref then
-            return false, e:cat(re)
+        if sourceset == "tag" then
+            ref = string.format("refs/tags/%s", src:get_tag())
+        else
+            ref = string.format("refs/heads/%s", src:get_branch())
         end
 
         tmpfn, re = e2lib.mktempfile()