aboutsummaryrefslogtreecommitdiff
path: root/src/lpm.lua
diff options
context:
space:
mode:
authorAdam Harrison <adamdharrison@gmail.com>2024-01-18 17:59:35 -0500
committerAdam Harrison <adamdharrison@gmail.com>2024-01-18 17:59:35 -0500
commit203ad3672a97d70de18a2b7e7f21eb401789474d (patch)
treebe38a0fc7fb2dfb25e54f5a07d9b472147576003 /src/lpm.lua
parente7bd5c0516f6906e80f74e584762774bfe789a90 (diff)
downloadlite-xl-plugin-manager-203ad3672a97d70de18a2b7e7f21eb401789474d.tar.gz
lite-xl-plugin-manager-203ad3672a97d70de18a2b7e7f21eb401789474d.zip
Removed looking for main/master; now ask directly what the primary branch is.
Diffstat (limited to 'src/lpm.lua')
-rw-r--r--src/lpm.lua17
1 files changed, 4 insertions, 13 deletions
diff --git a/src/lpm.lua b/src/lpm.lua
index 6118469..93c7a2f 100644
--- a/src/lpm.lua
+++ b/src/lpm.lua
@@ -1088,7 +1088,7 @@ function Repository:generate_manifest(repo_id)
addon_map[id].remote = path
pcall(function()
local repo = Repository.url(path):add()
- addon_map[id].remote = path .. ":" .. system.revparse(repo.local_path)
+ addon_map[id].remote = path .. ":" .. (repo.branch or repo.commit)
end)
end
else
@@ -1159,19 +1159,10 @@ function Repository:fetch()
path = self.repo_path .. PATHSEP .. "master"
common.rmrf(temporary_path)
common.mkdirp(temporary_path)
- log_progress_action("Fetching " .. self.remote .. ":master/main...")
+ log_progress_action("Fetching " .. self.remote .. "...")
system.init(temporary_path, self.remote)
- system.fetch(temporary_path, write_progress_bar)
- if not pcall(system.reset, temporary_path, "refs/remotes/origin/master", "hard") then
- if pcall(system.reset, temporary_path, "refs/remotes/origin/main", "hard") then
- path = self.repo_path .. PATHSEP .. "main"
- self.branch = "main"
- else
- error("can't find master or main.")
- end
- else
- self.branch = "master"
- end
+ self.branch = system.fetch(temporary_path, write_progress_bar)
+ if not self.branch then error("Can't find remote branch for " .. self.remote) end
self.local_path = path
else
path = self.local_path