diff --git a/lua/lazy/manage/git.lua b/lua/lazy/manage/git.lua index a365824..201e4e7 100644 --- a/lua/lazy/manage/git.lua +++ b/lua/lazy/manage/git.lua @@ -148,6 +148,14 @@ function M.get_target(plugin) return { branch = branch, commit = M.get_commit(plugin.dir, branch, true) } 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, ...) local ref = table.concat({ ... }, "/") diff --git a/lua/lazy/manage/task/git.lua b/lua/lazy/manage/task/git.lua index 774df16..8e0ef48 100644 --- a/lua/lazy/manage/task/git.lua +++ b/lua/lazy/manage/task/git.lua @@ -36,7 +36,7 @@ M.log = { table.insert(args, self.plugin._.updated.from .. ".." .. (self.plugin._.updated.to or "HEAD")) elseif opts.check then 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 for k, v in pairs(target) do error(k .. " '" .. v .. "' not found")