feat!: update tier 1 parsers to versions

This commit is contained in:
Christian Clason 2024-05-03 19:55:41 +02:00
parent b2d17c61dd
commit 1058d80eba

View file

@ -8,9 +8,21 @@ local updates = {} ---@type string[]
-- check for new revisions
for k, p in pairs(parsers) do
if p.tier < 5 and p.install_info then
if p.install_info then
print('Updating ' .. k)
jobs[k] = vim.system({ 'git', 'ls-remote', p.install_info.url })
local cmd = p.tier == 1
and {
'git',
'-c',
'versionsort.suffix=-',
'ls-remote',
'--tags',
'--refs',
'--sort=v:refname',
p.install_info.url,
}
or { 'git', 'ls-remote', p.install_info.url }
jobs[k] = vim.system(cmd)
end
if #vim.tbl_keys(jobs) % 100 == 0 or next(parsers, k) == nil then
@ -21,18 +33,23 @@ for k, p in pairs(parsers) do
local info = parsers[name].install_info
assert(info)
local branch = info.branch
local line = 1
if branch then
for j, l in ipairs(stdout) do
if l:find(vim.pesc(branch)) then
line = j
break
local sha ---@type string
if parsers[name].tier == 1 then
sha = stdout[#stdout - 1]:match('v[%d%.]+$')
else
local branch = info.branch
local line = 1
if branch then
for j, l in ipairs(stdout) do
if l:find(vim.pesc(branch)) then
line = j
break
end
end
end
sha = vim.split(stdout[line], '\t')[1]
end
local sha = vim.split(stdout[line], '\t')[1]
if info.revision ~= sha then
info.revision = sha
updates[#updates + 1] = name