Namespace: joker.git
v1.0Contents
Summary
Reads and mutates local Git repositories through go-git-backed map-oriented wrappers.
Index
Constants
Constants are variables with :const true in their metadata. Joker currently does not recognize them as special; as such, it allows redefining them or their values.-
(None.)
Variables
-
(None.)
Functions, Macros, and Special Forms
-
add-commit
Function v1.4(add-commit repo msg opts)Creates a commit from the current index and returns its hash string.
msg is the commit message. opts may contain:
- all - truthy to stage modified and deleted tracked files before committing
- allow-empty-commits - truthy to permit a commit with no tree changes
Throws Error when the worktree cannot commit. -
add-path
Function v1.4(add-path repo path)Stages path from the worktree into the index and returns a hash string.
Existing staged files may be staged again. Deleted files are removed from the
index. Directory paths are added recursively. Throws Error when the worktree
cannot be accessed or the path cannot be staged. -
commit
Function v1.3(commit repo hash)Returns the commit map for hash.
The result has the same shape as entries returned by joker.git/log. Throws
Error when hash does not name a commit. -
config
Function v1.3(config repo)Returns repo configuration as a map.
The map includes core properties such as :bare?, :worktree, :default-branch,
:user, :author, :committer, :remotes, :submodules, :branches, and :urls.
Throws Error when the configuration cannot be read. -
head
Function v1.3(head repo)Returns the repository HEAD reference map.
The returned map has the same shape as joker.git/ref. Throws Error when HEAD
cannot be resolved. -
log
Function v1.3(log repo opts)Returns commit history as a vector of commit maps.
Each commit map contains :hash, :author, :committer, :message, :tree-hash,
:parent-hashes, and :pgp-signature. Signature maps contain :name, :email, and
:when.
opts may have the following keys:
:from - commit hash string from which traversal starts. When set, the log
only contains commits
reachable from it. If this option is not set, HEAD will be used as
the default from.
:order - one of :default, :dfs, :dfs-post, :bsf, or :committer-time. The
default traversal is depth-first search. :committer-time is closer to
ordinary `git log` ordering.
:path-filter - filter commits based on the path of files that are updated.
The fn receives each path string and should return truthy for desired paths.
It can be used to implement `git log -- <path>`.
:all - pretend as if all the refs in refs/, along with HEAD, are listed on the command line as <commit>.
It is equivalent to running `git log --all`.
If set to true, the :from option will be ignored.
:since - show commits more recent than a specific date.
It is equivalent to running `git log --since <date>` or `git log --after <date>`.
:until - show commits older than a specific date.
It is equivalent to running `git log --until <date>` or `git log --before <date>`.
Throws Error when traversal cannot be started or completed, or when :order
has an unsupported value. -
object
Function v1.3(object repo hash)Returns a summary map for the Git object with hash.
The map contains :id and :type, where :type is one of :commit, :tree, :blob,
:tag, :ofs-delta, :ref-delta, :any, or :invalid. Throws Error when no object
can be found. -
open
Function v1.3(open path)Opens the Git repository at path and returns a GitRepo handle.
Detects both bare and worktree repositories. Throws Error when path does not
contain a valid repository or the repository cannot be opened. -
ref
Function v1.3(ref repo name resolved)Returns reference name as a map.
If resolved is true, symbolic references are resolved before being returned.
The result contains :type (:hash, :symbolic, or :invalid), :name, :target,
and :hash. Throws Error when the reference cannot be found. -
resolve-revision
Function v1.3(resolve-revision repo revision)Resolves revision to a commit hash string.
The result is always the commit hash, not a tree hash or annotated-tag hash.
Throws Error when revision cannot be resolved.