]> git.e2factory.org Git - e2factory.git/commitdiff
git.git_commit_id(): use lookup_id() function
authorTobias Ulmer <tu@emlix.com>
Tue, 5 Nov 2013 19:19:37 +0000 (20:19 +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>
plugins/git.lua

index ad472f73b4af63ccbccf0c8d3a859efc9faafad4..c27a4efa9eac5ee7a27d6585f8cc61e85be22edc 100644 (file)
@@ -138,19 +138,19 @@ function git.git_commit_id(info, sourcename, sourceset, check_remote)
     if sourceset == "branch" or (sourceset == "lazytag" and src.tag == "^") then
         ref = string.format("refs/heads/%s", src.branch)
 
-        rc, re, id = generic_git.git_rev_list1(gitdir, ref)
+        rc, re, id = generic_git.lookup_id(gitdir, false, ref)
         if not rc then
             return false, e:cat(re)
         end
     elseif sourceset == "tag" or (sourceset == "lazytag" and src.tag ~= "^") then
         ref = string.format("refs/tags/%s", src.tag)
 
-        rc, re, id = generic_git.git_rev_list1(gitdir, ref)
+        rc, re, id = generic_git.lookup_id(gitdir, false, ref)
         if not rc then
             return false, e:cat(re)
         end
 
-        if id ~= "" and check_remote then
+        if id and check_remote then
             rc, re = generic_git.verify_remote_tag(gitdir, src.tag)
             if not rc then
                 return false, e:cat(re)
@@ -160,7 +160,7 @@ function git.git_commit_id(info, sourcename, sourceset, check_remote)
         return false, err.new("not an scm sourceset: %s", sourceset)
     end
 
-    if id == "" then
+    if not id then
         re = err.new("can't get git commit ID for ref %q from repository %q",
             ref, src.working)
         return false, e:cat(re)