1
0
mirror of https://github.com/kepler155c/opus synced 2024-11-16 21:54:49 +00:00
opus/sys/apis/fs/gitfs.lua

20 lines
384 B
Lua
Raw Normal View History

2016-12-11 19:24:52 +00:00
local git = require('git')
local gitfs = { }
2017-09-16 00:27:56 +00:00
function gitfs.mount(dir, repo)
if not repo then
error('gitfs syntax: repo')
2016-12-11 19:24:52 +00:00
end
2017-09-16 00:27:56 +00:00
local list = git.list(repo)
2017-05-20 00:55:19 +00:00
for path, entry in pairs(list) do
2017-09-15 05:08:04 +00:00
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
2016-12-11 19:24:52 +00:00
end
end
return gitfs