1
0
mirror of https://github.com/kepler155c/opus synced 2025-02-08 05:00:00 +00:00
opus/sys/apis/fs/gitfs.lua

22 lines
385 B
Lua
Raw Normal View History

2016-12-11 14:24:52 -05:00
local git = require('git')
2017-10-08 17:45:01 -04:00
local fs = _G.fs
2016-12-11 14:24:52 -05:00
local gitfs = { }
2017-09-15 20:27:56 -04:00
function gitfs.mount(dir, repo)
2018-01-24 17:39:38 -05:00
if not repo then
error('gitfs syntax: repo')
end
2016-12-11 14:24:52 -05:00
2018-01-24 17:39:38 -05:00
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
2016-12-11 14:24:52 -05:00
end
return gitfs