Module gall.ll.git2
Low-Level C binding for Gall’s use of libgit2.
Functions
get_object (repository, oid) | Retrieve a generic object from git. |
get_object_raw (obj) | Retrieve the raw content of an object |
get_object_size (obj) | Retrieve the size of a git object. |
get_object_type (obj) | Retrieve a git object’s type |
get_tree_table (repository, tree) | Retrieve a tree’s content as a table
The returned table is a numerically indexed table of entries. |
lookup_sha_from_ref (repository, ref) | Lookup the SHA1 pointed at by a reference. |
lookup_symbolic_ref (repository, ref) | Dereference a symbolic ref. |
merge_base (repository, left, right) | Calculate the merge-base of a pair of OIDs. |
open_repo (repopath) | Open a repository from disk. |
set_symbolic_ref (repository, reference, referent) | Set a symbolic reference’s referent. |
Fields
LIBGIT2_VERSION | The version of libgit2 which this instance of gall was built against. |
Functions
- get_object (repository, oid)
-
Retrieve a generic object from git.
Parameters:
- repository llrepo The repository to retrieve the object from.
- oid string The object to return (as a SHA1)
Returns:
- gitobject The git object whose OID was provided (or nil)
- string The error message if the returned git object was nil
- get_object_raw (obj)
-
Retrieve the raw content of an object
Parameters:
- obj gitobject The object whose content you wish to retrieve.
Returns:
-
string
The raw content of the object as a string.
- get_object_size (obj)
-
Retrieve the size of a git object.
Parameters:
- obj gitobject The object whose size you wish to query
Returns:
-
number
The size of the object in bytes
- get_object_type (obj)
-
Retrieve a git object’s type
Parameters:
- obj gitobject The object whose type you wish to retrieve.
Returns:
-
string
The type of the object provided.
- get_tree_table (repository, tree)
-
Retrieve a tree’s content as a table
The returned table is a numerically indexed table of entries. Each entry is a table with
name
(string)sha
(string) andperms
(number) entries.Parameters:
- repository llrepo The repository to query for the tree’s content.
- tree string The OID of the tree object to retrieve
Returns:
- lookup_sha_from_ref (repository, ref)
-
Lookup the SHA1 pointed at by a reference.
Parameters:
- repository llrepo The repository to look up the reference in.
- ref string The reference to look up.
Returns:
- lookup_symbolic_ref (repository, ref)
-
Dereference a symbolic ref.
Parameters:
- repository llrepo The repository to look up the ref in.
- ref string The symbolic ref name to dereference.
Returns:
- merge_base (repository, left, right)
-
Calculate the merge-base of a pair of OIDs.
Parameters:
- repository llrepo The repository to calculate the merge-base within.
- left string The left-side of the merge as an OID.
- right string The right-side of the merge as an OID.
Returns:
- open_repo (repopath)
-
Open a repository from disk.
This function opens a repository on disk using libgit2. This low level repository type can be used in routines such as lookup_symbolic_ref or lookup_sha_from_ref.
Parameters:
- repopath string The path to the repository
Returns:
- llrepo The repository (or nil on error)
- string An error message (if repo is nil)
- set_symbolic_ref (repository, reference, referent)
-
Set a symbolic reference’s referent.
Parameters:
- repository llrepo The repository to set the reference within.
- reference string The reference to set.
- referent string The reference name to act as referent for reference.
Returns:
- boolean On success, true, otherwise nil.
- string On failure, the error message.