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:

  1. gitobject The git object whose OID was provided (or nil)
  2. 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) and perms (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:

  1. table The tree as a table, or nil on error
  2. string The error message if the returned tree table is nil
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:

  1. string The OID (SHA1) of the referent (or nil on error).
  2. string The error message if the OID is nil.
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:

  1. string The symbolic referent (or nil on error)
  2. string The error message if the referent is nil
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:

  1. string The OID of the merge-base if available, or nil on error.
  2. string The error message if the merge-base is nil.
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:

  1. llrepo The repository (or nil on error)
  2. 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:

  1. boolean On success, true, otherwise nil.
  2. string On failure, the error message.

Fields

LIBGIT2_VERSION
The version of libgit2 which this instance of gall was built against.

When Gall is compiled, the version of libgit2 is baked into the C binding to be checked against when run.

  • LIBGIT2_VERSION
generated by LDoc 1.4.3 Last updated 2016-10-27 06:21:07