fix(git): tagrefs

This commit is contained in:
Folke Lemaitre 2024-06-28 18:31:10 +02:00
parent a617d9f47b
commit 2a6a2dce1b
No known key found for this signature in database
GPG Key ID: 41F8B1FBACAE2040
1 changed files with 6 additions and 1 deletions

View File

@ -184,7 +184,12 @@ function M.get_tag_refs(repo, tagref)
tagref = tagref or "--tags" tagref = tagref or "--tags"
---@type table<string,string> ---@type table<string,string>
local tags = {} local tags = {}
local lines = Process.exec({ "git", "show-ref", "-d", tagref }, { cwd = repo }) local ok, lines = pcall(function()
return Process.exec({ "git", "show-ref", "-d", tagref }, { cwd = repo })
end)
if not ok then
return {}
end
for _, line in ipairs(lines) do for _, line in ipairs(lines) do
local ref, tag = line:match("^(%w+) refs/tags/([^%^]+)%^?{?}?$") local ref, tag = line:match("^(%w+) refs/tags/([^%^]+)%^?{?}?$")
if ref then if ref then