]> git.e2factory.org Git - e2factory.git/commitdiff
Document generic_git.sourceset2ref(), improve error reporting
authorTobias Ulmer <tu@emlix.com>
Wed, 20 Nov 2013 16:46:03 +0000 (17:46 +0100)
committerTobias Ulmer <tu@emlix.com>
Wed, 16 Nov 2016 14:41:17 +0000 (15:41 +0100)
Signed-off-by: Tobias Ulmer <tu@emlix.com>
generic/generic_git.lua

index cb7d59d2935a5ac19fba0c324ce73a6591af691b..66e8c2a8567a58fb4fd0fe0c255b0f758df104c1 100644 (file)
@@ -757,16 +757,21 @@ 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" or
-        (sourceset == "lazytag" and tag == "^") then
+    if sourceset == "branch" or (sourceset == "lazytag" and tag == "^") then
         return string.format("refs/heads/%s", branch)
-    elseif sourceset == "tag" or
-        (sourceset == "lazytag" and tag ~= "^") then
+    elseif sourceset == "tag" or (sourceset == "lazytag" and tag ~= "^") then
         return string.format("refs/tags/%s", tag)
     end
-    return nil, "invalid sourceset"
+
+    return false, err.new("not a valid sourceset combination: %q %q %q",
+        sourceset, branch, tag)
 end
 
 --- Create a new git source repository.