1
0
mirror of https://github.com/kepler155c/opus synced 2024-12-29 10:00:26 +00:00
opus/sys/apis/fs/gitfs.lua

18 lines
379 B
Lua
Raw Normal View History

2016-12-11 19:24:52 +00:00
local git = require('git')
local gitfs = { }
function gitfs.mount(dir, user, repo, branch)
if not user or not repo then
error('gitfs syntax: user, repo, [branch]')
end
local list = git.list(user, repo, branch)
2017-05-20 00:55:19 +00:00
for path, entry in pairs(list) do
local node = fs.mount(fs.combine(dir, path), 'urlfs', entry.url)
node.size = entry.size
2016-12-11 19:24:52 +00:00
end
end
return gitfs