mirror of
https://github.com/kepler155c/opus
synced 2024-12-24 15:40:26 +00:00
branch support
This commit is contained in:
parent
8ecfea1524
commit
558d271ae0
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
/ignore
|
@ -8,8 +8,9 @@ function gitfs.mount(dir, user, repo, branch)
|
||||
end
|
||||
|
||||
local list = git.list(user, repo, branch)
|
||||
for path, url in pairs(list) do
|
||||
fs.mount(fs.combine(dir, path), 'urlfs', url)
|
||||
for path, entry in pairs(list) do
|
||||
local node = fs.mount(fs.combine(dir, path), 'urlfs', entry.url)
|
||||
node.size = entry.size
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -31,7 +31,10 @@ function git.list(user, repo, branch)
|
||||
for k,v in pairs(data.tree) do
|
||||
if v.type == "blob" then
|
||||
v.path = v.path:gsub("%s","%%20")
|
||||
list[v.path] = string.format(FILE_URL, user, repo, branch, v.path)
|
||||
list[v.path] = {
|
||||
url = string.format(FILE_URL, user, repo, branch, v.path),
|
||||
size = v.size,
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -1,4 +1,13 @@
|
||||
local DEFAULT_UPATH = 'https://raw.githubusercontent.com/kepler155c/opus/master/sys/apis'
|
||||
local branch = 'master'
|
||||
if fs.exists('.branch') then
|
||||
local f = fs.open('.branch', "r")
|
||||
if f then
|
||||
branch = f.readAll()
|
||||
f.close()
|
||||
end
|
||||
end
|
||||
|
||||
local DEFAULT_UPATH = 'https://raw.githubusercontent.com/kepler155c/opus/' .. branch .. '/sys/apis'
|
||||
local PASTEBIN_URL = 'http://pastebin.com/raw'
|
||||
local GIT_URL = 'https://raw.githubusercontent.com'
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user