1
0
mirror of https://github.com/kepler155c/opus synced 2024-09-20 19:29:38 +00:00
opus/sys/apis/fs/gitfs.lua
kepler155c@gmail.com a625b52bad lint
2017-10-08 17:45:01 -04:00

22 lines
402 B
Lua

local git = require('git')
local fs = _G.fs
local gitfs = { }
function gitfs.mount(dir, repo)
if not repo then
error('gitfs syntax: repo')
end
local list = git.list(repo)
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