lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On 6 March 2013 16:12, Dirk Laurie <dirk.laurie@gmail.com> wrote:
> 2013/3/6 Peter Drahoš <drahosp@gmail.com>:
>>
>> Please consider using lua-git[1] to download the files directly from git.
>
> The page referred to is an extreme but not untypical example of why Lua
> users can't get off the ground in collaborative library writing. There is no
> README, no thumbnail description, no doc subdirectory.

I'm sorry for the state of the repository, but lua-git was my
proof-of-concept of accessing Git repositories from Lua (inspired by
Dulwich in Python), that ended up being usable enough for the purposes
of LuaDist. Unfortunately it provides only a minimum amount of code
necessary to do its job in LuaDist and is missing a lot of
functionality - essentially it is read-only, no committing, just
fetching from a git repository (git protocol only), forced shallow
fetch (although whole-history fetch is also supported) and accessing
local repositories. The API is also likely to change wildly, so it is
not yet documented.

If there is an interest in this project, I may provide a README with
some basic documentation, but currently the whole functionality can be
covered by the following test case:

require 'git'

local repoUrl = arg[1] or 'git://github.com/mkottman/lua-git.git'
local ref = arg[2] or 'refs/heads/master'

 -- a repo will be created in /tmp/test.git
R = git.repo.create('/tmp/test.git')
 -- a given ref is fetched from the server and stored in the
repository R, the ref SHA is returned (a commit)
local pack, sha = git.protocol.fetch(repoUrl, R, ref)
-- the commit is checked out to /tmp/extracted, which will contain all
the files and directories in the given commit
R:checkout(sha, '/tmp/extracted')