diff --git a/lua/lazy/manage/checker.lua b/lua/lazy/manage/checker.lua index f86e55e..79c265d 100644 --- a/lua/lazy/manage/checker.lua +++ b/lua/lazy/manage/checker.lua @@ -22,7 +22,7 @@ function M.fast_check(opts) 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 + if ok and info and target and not Git.eq(info, target) then plugin._.updates = { from = info, to = target } end end diff --git a/lua/lazy/manage/git.lua b/lua/lazy/manage/git.lua index 54f14b4..bbdd134 100644 --- a/lua/lazy/manage/git.lua +++ b/lua/lazy/manage/git.lua @@ -32,6 +32,14 @@ function M.info(repo, details) end end +---@param a GitInfo +---@param b GitInfo +function M.eq(a, b) + local ra = a.commit and a.commit:sub(1, 7) + local rb = b.commit and b.commit:sub(1, 7) + return ra == rb +end + function M.head(repo) return Util.head(repo .. "/.git/HEAD") end diff --git a/lua/lazy/manage/task/git.lua b/lua/lazy/manage/task/git.lua index d94d769..57388a6 100644 --- a/lua/lazy/manage/task/git.lua +++ b/lua/lazy/manage/task/git.lua @@ -41,7 +41,7 @@ M.log = { error("no target commit found") end assert(target.commit, self.plugin.name .. " " .. target.branch) - if target.commit ~= info.commit then + if not Git.eq(info, target) then self.plugin._.updates = { from = info, to = target } end table.insert(args, info.commit .. ".." .. target.commit) @@ -165,7 +165,7 @@ M.checkout = { -- dont run checkout if target is already reached. -- unless we just cloned, since then we won't have any data yet - if info.commit == target.commit and info.branch == target.branch then + if Git.eq(info, target) and info.branch == target.branch then self.plugin._.updated = { from = info.commit, to = info.commit,