diff options
author | Adam Harrison <adamdharrison@gmail.com> | 2023-01-22 13:59:58 -0500 |
---|---|---|
committer | Adam Harrison <adamdharrison@gmail.com> | 2023-01-22 13:59:58 -0500 |
commit | b6507b457fcc4a2e1cdffa04768e5dd48e43be99 (patch) | |
tree | 99e5fc38094a9c9b11ec126cf0677bc15f0066e3 | |
parent | ad9ee6370dde937213dfd55dcaa1ebd2662d4e26 (diff) | |
download | lite-xl-plugin-manager-b6507b457fcc4a2e1cdffa04768e5dd48e43be99.tar.gz lite-xl-plugin-manager-b6507b457fcc4a2e1cdffa04768e5dd48e43be99.zip |
Changed things around to make more sense and autodetect things.
-rw-r--r-- | src/lpm.lua | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/lpm.lua b/src/lpm.lua index d0f7122..eb9ade2 100644 --- a/src/lpm.lua +++ b/src/lpm.lua @@ -815,7 +815,6 @@ end function Repository.__index(self, idx) return rawget(self, idx) or Repository[idx] end function Repository.new(hash) if not hash.remote then error("requires a remote") end - if not hash.commit and not hash.branch then error("requires either a branch or commit specifier") end if not hash.remote:find("^%w+:") and system.stat(hash.remote .. "/.git") then hash.remote = "file://" .. system.stat(hash.remote).abs_path end if not hash.remote:find("^https?:") and not hash.remote:find("^file:") then error("only repositories with http and file transports are supported (" .. hash.remote .. ")") end local self = setmetatable({ @@ -837,7 +836,9 @@ function Repository.new(hash) error("can't find branch for " .. self.remote .. " in " .. self.repo_path) end end - self.local_path = self.repo_path .. PATHSEP .. (self.commit or self.branch) + if self.commit or self.branch then + self.local_path = self.repo_path .. PATHSEP .. (self.commit or self.branch) + end return self end |