debug
This commit is contained in:
@@ -41,7 +41,6 @@ local GIT_FILE = "git.lua"
|
|||||||
function string.beginsWith(str, comp)
|
function string.beginsWith(str, comp)
|
||||||
local compLen = string.len(comp)
|
local compLen = string.len(comp)
|
||||||
local begining = string.sub(str, 0, compLen)
|
local begining = string.sub(str, 0, compLen)
|
||||||
print(begining == comp, begining, comp)
|
|
||||||
return begining == comp
|
return begining == comp
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -73,7 +72,6 @@ local function parseGiteaURL(url)
|
|||||||
origin = "",
|
origin = "",
|
||||||
owner = "",
|
owner = "",
|
||||||
repo = "",
|
repo = "",
|
||||||
--branch = "",
|
|
||||||
treeUrl = "",
|
treeUrl = "",
|
||||||
}
|
}
|
||||||
local lowerUrl = string.lower(url)
|
local lowerUrl = string.lower(url)
|
||||||
@@ -88,7 +86,6 @@ local function parseGiteaURL(url)
|
|||||||
local protoLen = string.len(info.protocol)
|
local protoLen = string.len(info.protocol)
|
||||||
local endLen = string.len(ending)
|
local endLen = string.len(ending)
|
||||||
local cleaned = string.sub(url, protoLen + 1, urlLen - endLen)
|
local cleaned = string.sub(url, protoLen + 1, urlLen - endLen)
|
||||||
print("cleaned", cleaned)
|
|
||||||
|
|
||||||
local urlParts = string.split(cleaned, "/")
|
local urlParts = string.split(cleaned, "/")
|
||||||
if not (#urlParts) == 3 then error("Unexpected link length.") end
|
if not (#urlParts) == 3 then error("Unexpected link length.") end
|
||||||
@@ -96,10 +93,15 @@ local function parseGiteaURL(url)
|
|||||||
|
|
||||||
info.treeUrl =
|
info.treeUrl =
|
||||||
("%s%s/api/v1/repos/%s/%s/git/trees/%s%s?recursive=1")
|
("%s%s/api/v1/repos/%s/%s/git/trees/%s%s?recursive=1")
|
||||||
:format(info.protocol, info.base, info.owner, info.repo, ending)
|
:format(info.protocol, info.origin, info.owner, info.repo, ending)
|
||||||
|
print()
|
||||||
|
print("protocol: ", info.protocol)
|
||||||
|
print("origin: ", info.origin)
|
||||||
|
print("owner: ", info.owner)
|
||||||
|
print("repo: ", info.repo)
|
||||||
|
print("treeUrl: ", info.treeUrl)
|
||||||
for k, v in pairs(info) do
|
for k, v in pairs(info) do
|
||||||
if v == "" then
|
if v == "" or v == nil then
|
||||||
error("Could not parse " .. k .. " from link.")
|
error("Could not parse " .. k .. " from link.")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user