feat(ui): show new version that is available instead of general message

This commit is contained in:
Folke Lemaitre 2022-12-31 16:01:59 +01:00
parent a9de5910f2
commit 34e2c78e06
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040
6 changed files with 20 additions and 11 deletions

View file

@ -19,11 +19,11 @@ function M.fast_check(opts)
opts = opts or {}
for _, plugin in pairs(Config.plugins) do
if not plugin.pin and plugin._.installed then
plugin._.has_updates = nil
plugin._.updates = nil
local info = Git.info(plugin.dir)
local ok, target = pcall(Git.get_target, plugin)
if ok and info and target and info.commit ~= target.commit then
plugin._.has_updates = true
plugin._.updates = { from = info, to = target }
end
end
end
@ -45,7 +45,7 @@ function M.report(notify)
local lines = {}
M.updated = {}
for _, plugin in pairs(Config.plugins) do
if plugin._.has_updates then
if plugin._.updates then
table.insert(M.updated, plugin.name)
if not vim.tbl_contains(M.reported, plugin.name) then
table.insert(lines, "- **" .. plugin.name .. "**")

View file

@ -183,7 +183,7 @@ end
---@param plugins? LazyPlugin[]
function M.clear(plugins)
for _, plugin in pairs(plugins or Config.plugins) do
plugin._.has_updates = nil
plugin._.updates = nil
plugin._.updated = nil
plugin._.cloned = nil
plugin._.dirty = nil

View file

@ -35,7 +35,9 @@ M.log = {
local info = assert(Git.info(self.plugin.dir))
local target = assert(Git.get_target(self.plugin))
assert(target.commit, self.plugin.name .. " " .. target.branch)
self.plugin._.has_updates = target.commit ~= info.commit
if target.commit ~= info.commit then
self.plugin._.updates = { from = info, to = target }
end
table.insert(args, info.commit .. ".." .. target.commit)
else
vim.list_extend(args, opts.args or Config.options.git.log)