1
0
mirror of https://github.com/kepler155c/opus synced 2024-11-14 20:54:50 +00:00
opus/sys/apis/fs/gitfs.lua
kepler155c@gmail.com 64c68f2662 reorganization
2017-09-15 01:08:04 -04:00

20 lines
440 B
Lua

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)
for path, entry in pairs(list) do
if not fs.exists(fs.combine(dir, path)) then
local node = fs.mount(fs.combine(dir, path), 'urlfs', entry.url)
node.size = entry.size
end
end
end
return gitfs