# Namespace: joker.git

v1.0

## Contents

- Summary
- Index
- Constants
- Variables
- Functions, Macros, and Special Forms

## Summary

Provides API for accessing and manipulating git repositories.

## Index

- add-commit
- add-path
- commit
- config
- head
- log
- object
- open
- ref
- resolve-revision

## 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)

  Stores the current contents of the index in a new commit along with
  a log message from the user describing the changes.

- ### add-path

  Function v1.4

      (add-path repo path)

  Adds the file contents of a file in the worktree to the index. If the
  file is already staged in the index no error is thrown. If a file deleted
  from the workspace is given, the file is removed from the index. If a
  directory given, adds the files and all his sub-directories recursively in
  the worktree to the index. If any of the files is already staged in the index
  no error is thrown. When path is a file, the hash is returned.

- ### commit

  Function v1.3

      (commit repo hash)

  Returns a commit with the given hash.

- ### config

  Function v1.3

      (config repo)

  Returns git repo's config

- ### head

  Function v1.3

      (head repo)

  Returns the reference where HEAD is pointing to.

- ### log

  Function v1.3

      (log repo opts)

  Returns the commit history from the given opts.
  opts may have the following keys:
  :from - when the from option is set the log will only contain commits
  reachable from it. If this option is not set, HEAD will be used as
  the default from.
  :order - the default traversal algorithm is depth-first search.
  Set order to :committer-time for ordering by committer time (more compatible with `git log`).
  Set order to :bsf for breadth-first search
  :path-filter - filter commits based on the path of files that are updated.
  Takes file path as argument and should return true if the file is desired.
  It can be used to implement `git log -- <path>`.
  Either <path> is a file path, or directory path, or a regexp of file/directory 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>`.

- ### object

  Function v1.3

      (object repo hash)

  Returns an Object with the given hash.

- ### open

  Function v1.3

      (open path)

  Opens a git repository from the given path. It detects if the
  repository is bare or a normal one. Throws an error if the path doesn't contain a valid repository.

- ### ref

  Function v1.3

      (ref repo name resolved)

  Returns the reference for a given reference name. If resolved is
  true, any symbolic reference will be resolved.

- ### resolve-revision

  Function v1.3

      (resolve-revision repo revision)

  Resolves revision to corresponding hash. It will always
  resolve to a commit hash, not a tree or annotated tag.