Skip to content

Commit

Permalink
feat(ui): check pinned packages that can't be updated (#1139)
Browse files Browse the repository at this point in the history
* style: fix filter types

* feat: check outdated pinned plugins
  • Loading branch information
MariaSolOs authored Oct 23, 2023
1 parent 42fb1e8 commit 4446fdb
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 5 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,7 @@ return {
concurrency = nil, ---@type number? set to 1 to check for updates very slowly
notify = true, -- get a notification when new updates are found
frequency = 3600, -- check for updates every hour
check_pinned = false, -- check for pinned packages that can't be updated
},
change_detection = {
-- automatically check for config file changes and reload the ui
Expand Down
1 change: 1 addition & 0 deletions lua/lazy/core/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ M.defaults = {
concurrency = nil, ---@type number? set to 1 to check for updates very slowly
notify = true, -- get a notification when new updates are found
frequency = 3600, -- check for updates every hour
check_pinned = false, -- check for pinned packages that can't be updated
},
change_detection = {
-- automatically check for config file changes and reload the ui
Expand Down
9 changes: 8 additions & 1 deletion lua/lazy/manage/task/git.lua
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,14 @@ M.log = {
error("no target commit found")
end
assert(target.commit, self.plugin.name .. " " .. target.branch)
if not Git.eq(info, target) then
if Git.eq(info, target) then
if Config.options.checker.check_pinned then
local last_commit = Git.get_commit(self.plugin.dir, target.branch, true)
if not Git.eq(info, { commit = last_commit }) then
self.plugin._.outdated = true
end
end
else
self.plugin._.updates = { from = info, to = target }
end
table.insert(args, info.commit .. ".." .. target.commit)
Expand Down
1 change: 1 addition & 0 deletions lua/lazy/types.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
---@field is_local? boolean
---@field updates? {from:GitInfo, to:GitInfo}
---@field cloned? boolean
---@field outdated? boolean
---@field kind? LazyPluginKind
---@field dep? boolean True if this plugin is only in the spec as a dependency
---@field cond? boolean
Expand Down
12 changes: 8 additions & 4 deletions lua/lazy/view/sections.lua
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,12 @@ return {
title = "Breaking Changes",
},
{
---@param plugin LazyPlugin
filter = function(plugin)
return plugin._.updated and plugin._.updated.from ~= plugin._.updated.to
end,
title = "Updated",
},
{
---@param plugin LazyPlugin
filter = function(plugin)
return plugin._.cloned
end,
Expand All @@ -66,7 +64,7 @@ return {
{
---@param plugin LazyPlugin
filter = function(plugin)
return plugin._.updates
return plugin._.updates ~= nil
end,
title = "Updates",
},
Expand All @@ -90,9 +88,15 @@ return {
end,
title = "Not Installed",
},
{
filter = function (plugin)
return plugin._.outdated
end,
title = "Outdated",
},
{
filter = function(plugin)
return plugin._.loaded
return plugin._.loaded ~= nil
end,
title = "Loaded",
},
Expand Down

0 comments on commit 4446fdb

Please sign in to comment.