From 5f2fed5d871103640c1887f4268979b77815b229 Mon Sep 17 00:00:00 2001 From: Tobias Ulmer Date: Thu, 2 Feb 2017 15:49:10 +0100 Subject: [PATCH] generic_git: remove mostly unused sourceset2ref() helper Signed-off-by: Tobias Ulmer --- generic/generic_git.lua | 17 ----------------- plugins/git.lua | 7 ++++--- 2 files changed, 4 insertions(+), 20 deletions(-) diff --git a/generic/generic_git.lua b/generic/generic_git.lua index 2eae8a3..6a5b2b2 100644 --- a/generic/generic_git.lua +++ b/generic/generic_git.lua @@ -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 diff --git a/plugins/git.lua b/plugins/git.lua index ae3184a..396d007 100644 --- a/plugins/git.lua +++ b/plugins/git.lua @@ -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() -- 2.39.5