fix(git): only check for new commits for local plugins. Closes #1512

This commit is contained in:
Folke Lemaitre 2024-07-07 08:42:19 +02:00
parent 933f0b596c
commit 81d2bfffdc
No known key found for this signature in database
GPG Key ID: 41F8B1FBACAE2040
2 changed files with 9 additions and 1 deletions

View File

@ -148,6 +148,14 @@ function M.get_target(plugin)
return { branch = branch, commit = M.get_commit(plugin.dir, branch, true) } return { branch = branch, commit = M.get_commit(plugin.dir, branch, true) }
end end
---@param plugin LazyPlugin
---@return GitInfo?
function M.get_local_target(plugin)
local info = M.info(plugin.dir)
local branch = assert(info and info.branch or M.get_branch(plugin))
return { branch = branch, commit = M.get_commit(plugin.dir, branch, true) }
end
function M.ref(repo, ...) function M.ref(repo, ...)
local ref = table.concat({ ... }, "/") local ref = table.concat({ ... }, "/")

View File

@ -36,7 +36,7 @@ M.log = {
table.insert(args, self.plugin._.updated.from .. ".." .. (self.plugin._.updated.to or "HEAD")) table.insert(args, self.plugin._.updated.from .. ".." .. (self.plugin._.updated.to or "HEAD"))
elseif opts.check then elseif opts.check then
local info = assert(Git.info(self.plugin.dir)) local info = assert(Git.info(self.plugin.dir))
local target = assert(Git.get_target(self.plugin)) local target = assert(self.plugin._.is_local and Git.get_local_target(self.plugin) or Git.get_target(self.plugin))
if not target.commit then if not target.commit then
for k, v in pairs(target) do for k, v in pairs(target) do
error(k .. " '" .. v .. "' not found") error(k .. " '" .. v .. "' not found")