[[tags: egg]]
== git
[[toc:]]
=== Description
Bindings to the [[http://libgit2.github.com|libgit2]] library.
This library requires libgit2 0.18.0 and Chicken 4.7 or newer.
The source for this egg is available at [[http://github.com/evhan/chicken-git]].
=== Documentation
{{git}} provides an interface for reading & manipulating git repositories.
The library is split into two modules, {{git}} and {{git-lolevel}}:
* {{git-lolevel}} is essentially just the libgit2 API, thinly wrapped. Most of
the function signatures remain the same, with a few exceptions:
** Structures & pointers that would go on the stack are allocated
automatically.
** Return values are checked where appropriate, signaling an exception of type
{{git}} when negative.
** Pointer arrays are converted to rest arguments.
* {{git}} is a higher-level interface around {{git-lolevel}}, providing
record types for each libgit2 structure.
The following documentation applies to the {{git}} module.
=== Usage
(use git) ; or...
(use git-lolevel)
It's not recommended to mix the two without prefixing one or the other's
imports, as the two libraries share many identifiers.
=== API
==== Repository
repository
(repository? obj) => boolean
A {{repository}} corresponds to an on-disk Git repository.
Many objects are invalidated when the repository to which they belong is GC'd.
As such, a handle to a repository should be kept for as long as its objects are
in use.
(create-repository [path] [bare]) => repository
Creates & returns a new repository at the given {{path}}, or the value of
{{current-directory}} if no path is given. If {{bare}} is given and not {{#f}},
the repository will be created without a working directory. An error is
signaled if the path is invalid or the repository cannot be created.
(repository-open [path]) => repository
Opens the Git repository indicated by {{path}}, or the value of
{{current-directory}} if no {{path}} is given. {{path}} may point to a bare
repository, a working directory containing a ".git" directory, or a ".git"
directory directly.
(repository-path repository) => string
Returns the absolute path to the given {{repository}}'s Git directory,
either the topmost directory in the project (if the repository is bare)
or the ".git" subdirectory.
(repository-working-directory repository) => string
Returns the absolute path to the given {{repository}}'s working directory,
or {{#f}} if the repository is bare.
(repository-ref repository ref) => object
Looks up a Git object in the given {{repository}}. {{ref}} may be a SHA1 string,
{{oid}}, {{reference}}, {{blob*}}, {{commit}}, {{tag}} or {{tree}}. The returned
object will be of type {{blob*}}, {{commit}}, {{tag}} or {{tree}}, or {{#f}} if
no object matching the given {{ref}} is found.
(repository-empty? repository) => boolean
(repository-bare? repositoy) => boolean
Returns a boolean indicating whether the given {{repository}} is empty
(contains no commits) or bare (an exposed git directory without a working
directory).
(repository-head-orphan? repositoy) => boolean
(repository-head-detached? repositoy) => boolean
Returns a boolean indicating whether the given repository's HEAD (a
symbolic reference) is orphaned (unreferenced under the refs namespace)
or detached (refering to a commit rather than a branch).
==== OID
oid
(oid? obj) => boolean
An {{oid}} is a unique reference to a Git object, corresponding to a
40-character SHA1 object name.
(string->oid string) => oid
Creates an {{oid}} from the given string, which should be a 40-character SHA1
hash. An error is signaled if the string is not a valid hash.
(oid->string oid [length]) => string
Returns the string representation of the given {{oid}}. The optional integer
{{length}} specifies the length of the returned string, up to 40 characters.
(oid->path oid) => string
Returns the string representation of the given {{oid}} in the form "xx/...",
where "xx" is the first two characters of the SHA1 and "..." is the remainder.
(oid=? oid1 oid2) => boolean
Indicates whether the two {{oid}}s are the equivalent.
==== Reference
reference
(reference? obj) => boolean
A {{reference}} is a direct or indirect pointer to a Git commit object. A
repository's {{"HEAD"}} is a common example: it is a symbolic reference,
referring to the immediate reference {{"refs/heads/master"}}, which in turn
points at a {{commit}}.
(reference repository ref) => reference
Returns the {{reference}} specified by the given string {{ref}} from the
{{repository}}. {{ref}} must be a string referring to a valid reference, such
as {{"HEAD"}}, {{"ref/heads/master"}}, or {{"refs/tags/v0.1.0"}}. An error is
signalled if the reference doesn't exists.
(references-fold kons knil repository [type]) => object
Folds over the given {{repository}}'s references in unspecified order.
An optional {{type}} symbol may be provided to limit the types of
references returnd, and may be one of the symbols {{'oid}},
{{'symbolic}}, or {{'all}}. If no {{type}} is given, {{'all}} is used.
(references repository [type]) => list
Returns a list of all references in the given {{repository}}. A type
symbol may be given to filter the references, as in {{references-fold}}.
(repository-head repository) => reference
Returns a reference to this repository's HEAD (resolved to an OID), of
{{#f}} if it doesn't exist.
(reference-name reference) => string
(reference-id reference) => oid
Returns the name of the given {{reference}} and the {{oid}} of the
object referred to by the given {{reference}}, respectively.
(reference-resolve reference) => reference
Dereferences the given (possibly symbolic) {{reference}}, returning a new
non-symbolic {{reference}} pointing refering directly to an {{oid}}.
(reference-target reference) => string
Returns the {{oid}} or {{reference}} to which the given {{reference}}
refers.
(reference-rename reference name [force]) => reference
(reference-target-set! reference target) => void
{{reference-rename}} changes the name of the given {{reference}} to the
string {{name}} and returns the newly-updated {{reference}}. If
{{force}} is given and nonfalse, any previously-existing {{reference}}
of the given {{name}} will be overwritten.
{{reference-target-set!}} updates a {{reference}} to refer to the given
{{target}}. If {{reference}} is an immediate reference (referring to an object
ID), {{target}} must be an {{oid}}, {{commit}}, or SHA1 string. If
{{reference}} is symbolic, {{target}} must be a {{reference}} or reference
name. It is an error to assign a symbolic reference an OID target and
vice-versa.
On success, the on-disk repository is updated immediately.
(create-reference repository #!key name target [symbolic] [force]) => reference
Creates & returns a new reference in the given {{repository}} for the specified
{{name}} and {{target}}. If {{symbolic}} is given and not {{#f}}, the created
reference will be so, and {{target}} must be a reference name or {{reference}}.
Otherwise, {{target}} must be a SHA1 string, {{oid}}, {{commit}} or
{{reference}} to a {{commit}}. If a reference of the given {{name}} exists and
{{force}} is not given or {{#f}}, an error is signalled. Otherwise, creation
is forced and the old reference will be overwritten.
On success, the on-disk repository is updated immediately.
==== Branch
(create-branch repository name target [force]) => reference
Creates a new branch in the given {{repository}} of the given {{name}} and
{{target}} and returns a {{reference}} to the new branch. {{target}} must be a
{{commit}} or {{tag}} belonging to the repository. If a branch of the given
{{name}} exists and {{force}} is not given or {{#f}}, an error is signalled.
Otherwise, creation is forced and the old branch is be overwritten.
On success, the on-disk repository is updated immediately.
(branches-fold kons knil repository [type]) => object
Folds over the given {{repository}}'s branches in unspecified order.
A {{type}} symbol may be given, either {{'local}}, {{'remote}}, or
{{'all}}, to specify what type of branches should be listed; by default,
{{'all}} is used.
(branches repository [type]) => list
Returns a list {{reference}} objects for each branch in the given
{{repository}}. A type symbol may be given to filter the branches, as in
{{branches-fold}}.
(branch-name reference) => string
Returns the name of the given branch {{reference}}. This is similar to
{{reference-name}}, but the leading reference namespace (e.g.
"refs/heads") is omitted.
(branch-rename reference name [force]) => reference
Renames the given branch {{reference}} to {{name}}, which should be a
string. If {{force}} is given and not false, any existing branch with
the given name will be overwritten. A new, renamed {{reference}} is
returned.
On success, the on-disk repository is updated immediately.
(branch-delete reference) => void
Deletes the given branch {{reference}} from its repository.
On success, the on-disk repository is updated immediately.
==== Generic
(object-id object) => oid
Returns the {{oid}} of the given object, which must be a {{commit}},
{{tree}}, {{tag}} or {{blob*}}.
(object-sha object [length]) => string
Returns the SHA1 identifier corresponding to the given object, which may be a
{{commit}}, {{tree}}, {{tag}} {{blob*}}, {{reference}}, {{oid}} or {{string}}.
(object-type object) => symbol
Returns a symbol specifying the type of the given object, which must be
a {{commit}}, {{tree}}, {{tag}} or {{blob*}}. {{#f}} is returned if the
object's type cannot be determined.
(object=? object1 object2) => boolean
Indicates whether the two Git objects represent the same thing (judging
by their respective {{oid}}s). Each object of type {{commit}}, {{tree}},
{{tag}} or {{blob*}}.
==== Blob*
blob*
(blob*? obj) => boolean
A {{blob*}} corresponds to Git's Blob object type, renamed in order to avoid
name clashes with Chicken's built-in {{blob}} type. It represents a file.
(blob* repository ref) => blob*
Returns the {{blob*}} specified by the given {{ref}} from the repository.
{{ref}} may be a SHA1 string, {{oid}}, or {{blob*}}. An error is signaled if
no such {{blob*}} exists.
(blob*-content blob*) => blob
Returns a blob (of the CHICKEN built-in type) of the contents of the
given {{blob*}} (of the Git object type).
(blob*-size blob*) => int
Returns the size in bytes of the given {{blob*}}.
(blob*-binary? blob*) => boolean
Indicates whether the given {{blob*}} is (likely to be) a binary chunk
or not.
(create-blob* repository source) => blob*
Creates a new {{blob*}} in the given {{repository}}.
{{source}} is the data source for the {{blob*}}, and may be a blob (of
the CHICKEN built-in type) or a pathname string indicating a file on the
local disk or, if such a file isn't present, a file relative to the
repository's working directory.
On success, the on-disk repository is updated immediately.
==== Commit
commit
(commit? obj) => boolean
A {{commit}} corresponds to Git's commit object type.
(commit repository ref) => commit
Returns the {{commit}} specified by the given {{ref}} from the repository.
{{ref}} may be a SHA1 string, {{oid}}, {{reference}} or {{commit}}. An error
is signaled if no such {{commit}} exists.
(commits-fold kons knil repository #!key [initial] [hide] [sort]) => object
Folds over the given {{repository}}'s commits. If an {{initial}} {{commit}} or
SHA1 is given, only commits that are ancestors of that revision will be
returned. If a list of revisions to {{hide}} is given, they and their ancestors
will be ignored. If a {{sort}} is specified, commits will be collected in the
given order; this sort order must be one of the symbols {{'none}}, {{'topo}},
{{'time}} or {{'reverse}}.
(commits repository #!rest args) => list
Returns a list of the {{commit}}s in the given {{repository}}. {{args}} follows
the {{#!key}} arguments specification for {{commits-fold}}.
(commit-id commit) => oid
Returns the {{oid}} for the given {{commit}}.
(commit-time commit) => int
(commit-time-offset commit) => int
{{commit-time}} and {{commit-time-offset}} return the timestamp of the given
{{commit}} and its UTC offset in minutes, respectively.
(commit-message commit) => string
(commit-message-encoding commit) => string
Returns the full commit message or message encoding for the given
{{commit}}.
(commit-tree commit) => tree
(commit-tree-id commit) => oid
Return the {{tree}} associated with the given {{commit}} and its {{oid}},
respectively.
(commit-author commit) => signature
(commit-committer commit) => signature
{{commit-author}} and {{commit-committer}} return the given {{commit}}'s
respective {{signature}}s.
(commit-parentcount commit) => int
(commit-parent commit [n]) => commit
{{commit-parentcount}} returns the number of parents for a given {{commit}}.
{{commit-parent}} returns the {{n}}th parent of the given {{commit}}, or
the first parent if no {{n}} is given. If the {{commit}} has no parent,
{{#f}} is returned.
(create-commit repository #!key message author [committer] [tree] [parents] [reference]) => commit
Creates & returns a new commit in the given {{repository}}. The string
{{message}} will be used as the commit's message and {{tree}} will be
the file tree of the commit. If no {{tree}} is given, the current state
of the repository's {{index}} is used. {{parents}} may be be a (possibly
empty) list of commits to be used as this commit's ancestors. {{author}}
and {{committer}} should be signatures; if {{committer}} is not given,
{{author}} will be used for both. {{reference}}, if given and not
{{#f}}, should be the {{reference}} or name of a {{reference}} that will
be updated to point to the newly-created commit.
Note that if no {{reference}} is given, the commit will be created in Git's
database but will not be reflected in any of the repository's branches. To
update the the working branch with the new commit, for example, use "HEAD".
On success, the on-disk repository is updated immediately.
(merge-base repository commit1 commit2) => commit
Returns the nearest common ancestor for the given commits. {{commit1}} and
{{commit2}} may be {{commit}}s, commit {{oid}}s, or SHA1 hashes.
==== Tag
tag
(tag? obj) => boolean
A {{tag}} corresponds to Git's Tag object type, which is a way to mark a
specific object as special in some way.
(tag repository ref) => tag
Creates & returns the {{tag}} specified by the given {{ref}} from the
repository. {{ref}} may be a SHA1 string, {{oid}}, or {{tag}}. An error is
signaled if no such {{tag}} exists.
(tags-fold kons knil repository) => object
Folds over the given repository's {{tag}}s in unspecified order.
(tags repository) => list
Returns a list of all tags in the given {{repository}}.
(tag-id tag) => oid
Returns the {{oid}} for the given {{tag}}.
(tag-type tag) => symbol
Returns the object type symbol of the target of the given {{tag}}, which will
be one of {{'commit}}, {{'tree}}, {{'blob}}, or {{'tag}}.
(tag-name tag) => string
(tag-message tag) => string
Return the name or message of the given {{tag}}.
(tag-tagger tag) => signature
Returns the {{signature}} of the {{tag}}'s creator.
(tag-peel tag) => object
Recursively dereferences the given {{tag}} until a non-tag object to
which it refers is found (and returned).
(tag-target tag) => object
(tag-peel tag) => object
{{tag-target}} returns the object referred to by {{tag}}, which will be of type
{{commit}}, {{tree}}, {{blob}} or {{tag}}.
Returns the object immediately referred to by {{tag}}, which will be of
type {{commit}}, {{tree}}, {{blob}} or {{tag}}.
(tag-delete tag) => void
Destroys the given {{tag}}.
On success, the on-disk repository is updated immediately.
(create-tag repository #!key target name message tagger [force]) => tag
Creates & returns a new tag in the given {{repository}} for the specified
{{name}}, {{message}} and {{target}}. {{name}} and {{message}} must be strings,
{{tagger}} must be a {{signature}},and {{target}} must be a {{commit}},
{{tree}} or {{blob*}}. If a tag of the given {{name}} exists and {{force}} is
not given or {{#f}}, an error is signalled. Otherwise, creation is forced and
the old tag will be overwritten.
On success, the on-disk repository is updated immediately.
==== Tree
tree
(tree? obj) => boolean
A {{tree}} corresponds to Git's Tree object type, which represents a directory
tree.
(tree repository ref) => tree
Returns the {{tree}} specified by the given {{ref}} from the repository. {{ref}}
may be a SHA1 string, {{oid}}, or {{tree}}. An error is signaled if no such
{{tree}} exists.
(tree-id tree) => oid
Returns the {{oid}} for the given {{tree}}.
(tree-entrycount tree) => int
Returns the number of entries in the given {{tree}}. This count does not
include entries of contained directories.
(tree-ref tree key) => tree-entry
Returns a {{tree-entry}} object for the given {{key}} from the tree, or
{{#f}} if no such tree entry is found. {{key}} may be a zero-based
integer index or a pathname string relative to the repository's working
directory.
(tree-fold kons knil tree) => object
Folds over each path and {{tree-entry}} objects in the given {{tree}}.
Note that {{kons}} should be a function of three arguments; the path to
the current {{tree-entry}} (a string, relative to the repository's working
directory), the current {{tree-entry}}, and the current state of the
fold.
(tree-entries tree) => list
Returns an alist of all {{tree-entry}} objects in the given {{tree}},
whose keys are the pathname strings indicating the {{tree-entry}}'s
location in the repository and whose keys are the {{tree-entry}} objects
themselves.
(create-tree repository index) => tree
Creates and returns a new {{tree}} object from the state of the given
{{index}} in the given {{repository}}.
On success, the new value is written immediately to disk.
==== Tree Entry
tree-entry
(tree-entry? obj) => boolean
A {{tree-entry}} represents a single node in a {{tree}} object.
(tree-entry-id tree-entry) => oid
Returns the {{oid}} of the given {{tree-entry}}.
(tree-entry-name tree-entry) => string
Returns the name of the given {{tree-entry}}.
(tree-entry-attributes tree-entry) => int
Returns the Unix file attributes of the given {{tree-entry}}.
(tree-entry-type tree-entry) => symbol
Returns the object type symbol, either {{'tree}} or {{'blob}}, of the given
{{tree-entry}}.
(tree-entry->object repository tree-entry) => object
Returns an object of type {{tree}} or {{blob*}} from the given {{tree-entry}}
and {{repository}}, which must be the owner of the {{tree-entry}}.
==== Tree Builder
tree-builder
(tree-builder? obj) => boolean
A tree builder provides a way to construct {{tree}} objects in memory and write
them to a repository, without using an index as an intermediary.
(make-tree-builder [tree]) => tree-builder
Creates a new {{tree-builder}}. If a {{tree}} is given, it is used as the
constructed tree's initial state. Otherwise, it must be populated manually
using {{tree-builder-insert}}.
(tree-builder-insert tree-builder object name attributes) => tree-entry
Inserts {{object}} into the {{tree-builder}}'s tree under the given filename
{{name}}. The inserted object must be a {{tree}} or {{blob*}}, and will have
the given {{attributes}} (an integer file mode).
(tree-builder-ref tree-builder path) => tree-entry
Returns the {{tree-entry}} from the given {{tree-builder}} at {{path}}, which
should be a filename string. If the requested file doesn't exist, {{#f}} is
returned.
(tree-builder-remove tree-builder path) => void
Removes the object at the given {{path}} from the {{tree-builder}}'s tree.
(tree-builder-write repo tree-builder) => tree
Writes the {{tree-builder}}'s current state to the given {{repository}},
modifying the on-disk repository on success. The resulting {{tree}} is
returned.
==== Diff
diff
(diff? obj) => boolean
(diff-path diff) => string
(diff-status diff) => symbol
(diff-similarity diff) => integer
(diff-old-file diff)
(diff-new-file diff)
diff-file
(diff-file? obj) => boolean
(diff-file-id diff-file) => oid
(diff-file-path diff-file) => string
(diff-file-size diff-file) => integer
(diff-file-mode diff-file) => integer
A {{diff}} is the difference in a single file between two Git {{tree}}s.
Each diff has a path, status, similarity, and a pair of {{diff-file}}s
for the old and new files, respectively (retrieved by {{diff-old-file}}
and {{diff-new-file}}).
Each {{diff-file}} has an {{id}}, {{path}}, {{size}} and {{mode}} (Unix
file attributes).
(diff-status diff) => symbol
Returns a symbol representing the status of a {{diff}}, which will be
one of the following symbols, or a list of them if the {{diff}}'s file
is in multiple statuses:
modified
added
deleted
modified
renamed
copied
ignored
untracked
(diff-similarity diff) => integer
Returns an integer value from 0 to 100 representing the similarity between a
{{diff}}'s old and new files, high values being representing greater
similarity.
(diff-old-file diff)
(diff-new-file diff)
Returns the {{diff-file}} object for the old and new file of the given
{{diff}}, respectively. If the file is added or deleted, {{#f}} will be
returned for the diff's old or new file, respectively.
(diff repository [object1 [object2]]) => list
Returns a list of {{diff}} objects.
{{diff}}'s behavior is as follows, given the following arguments:
* {{()}}: diff the repository's index to its working directory
* {{(index)}}: diff the given index to the repository's working directory
* {{(tree)}}: diff the given tree to the repository's working directory
* {{(tree tree)}}: diff the given trees
* {{(tree index)}}: diff the given tree to the given index
==== Status
(file-status repository path) => symbol
Returns the status of the file specified by {{path}} in the given
{{repository}}.
This status will be one of the following symbols, or a list of them if
the file is in multiple statuses:
current
index/new
index/modified
index/deleted
worktree/new
worktree/modified
worktree/deleted
ignored
(file-statuses-fold kons knil repository) => object
Folds over each path and corresponding file status in the given
{{repository}}'s working directory.
Note that {{kons}} should be a function of three arguments; the pathname
of the current file (a string, relative to the repository's working
directory), the current status symbol, and the current state of the
fold.
(file-statuses repository) => list
Returns an alist all file statuses in the given {{repository}}, whose
keys are the pathnames of the file in the repository and whose keys are
the status symbols of the files.
(file-ignored? repository path) => boolean
Returns a boolean indicating whether the given {{path}} in {{repository}} is
ignored by Git or not.
==== Index
index
(index? obj) => boolean
An {{index}} represents the on-disk state of Git's working tree. Changes made
to a given {{index}} exist only in memory until written to disk using
{{index-write}}.
(index-open repo-or-path) => index
It {{repo-or-path}} is a {{repository}}, returns the repository's index. If it
is a string, creates and returns the index at the given path, signaling an
error if such an index doesn't exist. It is not possible to open the index of a
bare repository, and doing so will result in an exception.
(index-entrycount index) => int
Returns the total number of index entries entries of the given
{{index}}, respectively. This is essentially a count of all files
tracked by Git in a given repository.
(index-read index) => void
Updates the given {{index}} to reflect the current state of the on-disk
repository.
(index-write index) => void
Writes the state of the given {{index}} from memory onto disk, modifying
the repository on success.
(index-clear index) => void
Removes all enries from a given {{index}}.
(index-add index path [stage]) => void
Adds a given {{path}}, which must refer to a file relative to the index's
repository, to the {{index}}. If an integer {{stage}} is given, it will be used
as the staging number for the changes.
(index-remove index ref) => void
Removes an entry from the given {{index}}. {{ref}} may be a file path string or
an zero-based integer index. If no entry is removed, {{#f}} is returned.
(index-find index path) => int
Returns the zero-based integer index of the file specified by {{path}} in the
given {{index}}, signaling an error if it doesn't exist.
(index-ref index key [type]) => index-entry
Returns the {{index-entry}} from the {{index}} for the given {{key}}, which may
be an zero-based integer index or a pathname string, or {{#f}} if no such entry
exists. If a type symbol is given, either {{'merged}} (the default behavior) or
{{'unmerged}}, the search will be limited to such entries.
==== Index Entry
index-entry
(index-entry? obj) => boolean
An {{index-entry}} represents a tracked file in Git's working directory,
belonging to an {{index}}.
(index-entry-id index-entry) => oid
Returns the {{oid}} referring to the given {{index-entry}}.
(index-entry-path index-entry) => string
Returns the file path of the given {{index-entry}} relative to the owning
repository's working directory.
(index-entry-ctime index-entry) => int
(index-entry-mtime index-entry) => int
(index-entry-dev index-entry) => int
(index-entry-ino index-entry) => int
(index-entry-size index-entry) => int
(index-entry-stage index-entry) => int
(index-entry-uid index-entry) => int
(index-entry-gid index-entry) => int
(index-entry-mode index-entry) => int
(index-entry-flags index-entry) => int
(index-entry-extended index-entry) => int
These methods return the file attributes for the given {{index-entry}} as it
exists in its in-memory {{index}}.
==== ODB
odb
(odb? obj) => boolean
An {{odb}} offers a direct interface to Git's internal object database.
(odb-open repo-or-path) => odb
It {{repo-or-path}} is a {{repository}}, returns the repository's object
database. If it is a string, creates and returns the object database at the
given path, signaling an error if no such database exists.
(odb-has-object? odb ref) => boolean
Determines if the given {{odb}} contains the given object {{ref}}, which should
be a SHA1 string, {{oid}} or Git object of type {{commit}}, {{blob*}}, {{tree}}
or {{tag}}.
(odb-read odb ref) => odb-object
Reads the given object {{ref}} from the database, signaling an error if it
doesn't exist. {{ref}} should be a SHA1 string, {{oid}} or Git object of type
{{commit}}, {{blob*}}, {{tree}} or {{tag}}.
(odb-write odb data [type]) => oid
Writes a given data {{blob}} to the {{odb}}, returning an {{oid}} referring to
the newly-created object. The type of the stored data can be specified by an
optional {{type}} symbol, which defaults to {{'blob}}.
(odb-hash odb data [type]) => oid
Returns an {{oid}} reference for the given data {{blob}} as though it had been
stored to the given {{odb}} but without writing it to disk. The type of the
hashed data can be specified by an optional {{type}} symbol, which defaults to
{{'blob}}.
==== ODB Object
odb-object
(odb-object? obj) => boolean
An {{odb-object}} is a reference to a blob of data in a Git object database.
(odb-object-id odb-object) => oid
Returns the {{oid}} for the given {{odb-object}}.
(odb-object-size odb-object) => int
Returns the size of the {{odb-object}}'s data in bytes.
(odb-object-type odb-object) => symbol
Returns the object type symbol of the given {{odb-object}}.
(odb-object-data odb-object) => blob
Returns a blob consisting of the {{odb-object}}'s data.
==== Signature
signature
(signature? obj) => boolean
A signature is a record of the name, email, time and UTC offset of a given Git
object.
(make-signature name email [time [offset]]) => signature
Returns a new {{signature}} for the given name and email strings. If a
timestamp {{time}} and integer {{offset}} are given, they will be used as the
signature time; otherwise, the current time will be used.
Unlike the {{create-*}} functions, no representation of this signature is
created in the repository; it exists only in memory until associated with a
{{commit}} or {{tag}}.
(signature-name signature) => string
(signature-email signature) => string
{{signature-name}} and {{signature-email}} return strings for the
given {{signature}}'s respective fields.
(signature-time signature) => int
(signature-time-offset signature) => int
{{signature-time}} and {{signature-time-offset}} return the timestamp of the
given {{signature}} and its UTC offset in minutes, respectively.
==== Config
config
(config? obj) => boolean
A {{config}} represents a Git configuration file, associated with either a
repository, the current user, or the system-wide Git installation.
(config-path [type]) => string
Returns the path to a Git configuration file, if one exists. {{type}}
may be a symbol specifying the type of path to search, either {{'user}},
{{'system}} or {{'xdg}}, to request the path to the configuration for
the current user, the system-wide Git installation, or the configuration
file path specified by the XDG standard (".config/git/config"),
respectively. {{type}} defaults to {{'user}}. An error is signalled if
no configuration file is found at the requested location.
(config-open [source]) => config
Reads the Git configuration file indicated by {{source}}, which may be a
{{repository}}, path, or symbol as expected by {{config-path}}. An
error is signalled if no configuration file is found at the requested location.
(config-get config name [type]) => object
Returns the value of the property {{name}} in the given {{config}}
object. The value is returned as a string, unless an alternative return
type is specified by the given symbol {{type}}, which should be
{{'string}}, {{'symbol}}, {{'number}} or {{'boolean}}. An error is
signaled if the requested property doesn't exist, or if it cannot be
converted to the specified return type.
(config-set config name value) => object
Sets the value of the property {{name}} in the given {{config}} object to the
given {{value}}.
On success, the new value is written immediately to disk.
(config-unset config name) => void
Deletes the property {{name}} from the given {{config}} object.
On success, the change is written immediately to disk.
=== History
* 0.0.19 - libgit2 0.18.0 reference & branch API updates
* 0.0.18 - libgit2 0.18.0
* 0.0.17 - libgit2 0.17.0 test fixes
* 0.0.16 - libgit2 0.17.0 diff & branch API updates, improved C callback safety
* 0.0.15 - libgit2 0.17.0 diff API update
* 0.0.14 - libgit2 0.17.0
* 0.0.13 - libgit2 0.16.0
=== Author
Evan Hanson
=== License
Copyright (c) 2013, Evan Hanson, 3-Clause BSD License