aboutsummaryrefslogtreecommitdiff
path: root/src/lpm.lua
diff options
context:
space:
mode:
authorAdam Harrison <adamdharrison@gmail.com>2024-06-09 13:29:49 -0400
committerAdam Harrison <adamdharrison@gmail.com>2024-06-09 13:29:49 -0400
commit6e33089dff1bcc2919c51decca7471c32c83a46e (patch)
treec630daf25c53a06c34bb3a031f85e9d3222ce1c5 /src/lpm.lua
parent259331a015432cfd47eb5c6161c6ddf05288a01c (diff)
downloadlite-xl-plugin-manager-6e33089dff1bcc2919c51decca7471c32c83a46e.tar.gz
lite-xl-plugin-manager-6e33089dff1bcc2919c51decca7471c32c83a46e.zip
Added in fallback to fetch everything if we can't find a specific object.
Diffstat (limited to 'src/lpm.lua')
-rw-r--r--src/lpm.lua9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/lpm.lua b/src/lpm.lua
index 901c02e..6779e95 100644
--- a/src/lpm.lua
+++ b/src/lpm.lua
@@ -1262,10 +1262,11 @@ function Repository:fetch()
end
if not exists or self.branch then
log.progress_action("Fetching " .. self.remote .. ":" .. (self.commit or self.branch) .. "...")
- if self.commit then
- system.fetch(temporary_path or path, write_progress_bar, self.commit)
- elseif self.branch then
- system.fetch(temporary_path or path, write_progress_bar, "+refs/heads/" .. self.branch .. ":refs/remotes/origin/" .. self.branch)
+ local status, err = pcall(system.fetch, temporary_path or path, write_progress_bar, self.commit or ("+refs/heads/" .. self.branch .. ":refs/remotes/origin/" .. self.branch))
+ if not status and err:find("cannot fetch a specific object") then
+ system.fetch(temporary_path or path, write_progress_bar, nil, true)
+ elseif not status then
+ error(err, 0)
end
common.reset(temporary_path or path, self.commit or self.branch, "hard")
end