fix(git): better errors when a branch/tag/version could not be found. Fixes #276

This commit is contained in:
Folke Lemaitre 2023-01-02 19:01:02 +01:00
parent 85173dcc4d
commit 277a2ab10b
No known key found for this signature in database
GPG Key ID: 41F8B1FBACAE2040
1 changed files with 6 additions and 0 deletions

View File

@ -34,6 +34,12 @@ M.log = {
elseif opts.check then
local info = assert(Git.info(self.plugin.dir))
local target = assert(Git.get_target(self.plugin))
if not target.commit then
for k, v in pairs(target) do
error(k .. " '" .. v .. "' not found")
end
error("no target commit found")
end
assert(target.commit, self.plugin.name .. " " .. target.branch)
if target.commit ~= info.commit then
self.plugin._.updates = { from = info, to = target }