generic (make-object class id/name repository &key url type force target signature message log-message &allow-other-keys)#
(make-object (class (eq REFERENCE)) (name T) (repository T) &KEY (TYPE :OID) FORCE TARGET SIGNATURE (LOG-MESSAGE ""))
(make-object (class (eq BRANCH)) (name T) (repository T) &KEY TARGET FORCE)
(make-object (class (eq TAG)) (name T) (repository T) &KEY (TYPE :ANNOTATED) FORCE TARGET SIGNATURE MESSAGE)
(make-object (class (eq REMOTE)) (name T) (repository T) &KEY URL)

Create objects within a Git repository, Please see the documentation for each implementing method.


generic (get-object class id/name repository)#
(get-object (class (eq OBJECT)) (oid T) (repository T))
(get-object (class (eq BLOB)) (oid T) (repository T))
(get-object (class (eq TREE)) (oid T) (repository T))
(get-object (class (eq COMMIT)) (oid T) (repository T))
(get-object (class (eq COMMIT)) (commit COMMIT) (repository T))
(get-object (class (eq REFERENCE)) (name T) (repository T))
(get-object (class (eq TAG)) (name-or-oid T) (repository T))
(get-object (class (eq REMOTE)) (name T) (repository T))
(get-object (class (eq ODB-OBJECT)) (oid T) (odb ODB))
(get-object (class (eq ODB-OBJECT)) (oid T) (repository REPOSITORY))

Return an object of type CLASS from the object database. The lookup will use either an oid or a name to find the object.

generic (list-objects class repository &key test test-not)#
(list-objects (class (eq REFERENCE)) (repository T) &KEY TEST TEST-NOT)
(list-objects (class (eq TAG)) (repository T) &KEY TEST TEST-NOT)
(list-objects (class (eq REMOTE)) (repository T) &KEY TEST TEST-NOT)
(list-objects (class (eq :OID)) (repository ODB) &KEY TEST TEST-NOT)
(list-objects (class (eq :OID)) (repository REPOSITORY) &KEY TEST TEST-NOT)

Note that although we are looking up a commit we specify as class OBJECT. The advantage of specifying OBJECT instead of COMMIT is that you do not need to know that the SHA refers to a commit. If the SHA refers to a tag a tag will be returned.

However if we do not know the SHA-1 but we do know a reference, such as a branch name or tag. We can get to the commit in a slightly more cumbersome way. (A list of references is easy to get, see the previous section.)


generic (oid object)#
(oid (object CL-GIT::GIT-OBJECT))
(oid (reference REFERENCE))
(oid (object ODB-OBJECT))

Return the identifier of OBJECT. The identifier is typically the SHA-1 checksum or hash code.

Note that this is an integer, and not the string you typically see reported by Git.

To get the string representation use format like this:

(format nil “~40,’0X” (oid object))

or if you want lowercase hexadecimal digits:

(format nil “~(~40,’0X~)” (oid object))

generic (full-name object)#
(full-name (object CL-GIT::GIT-OBJECT))
(full-name (object REFERENCE))
(full-name (tag TAG))
(full-name (remote REMOTE))

Returns the name of OBJECT, as a string.

What exactly the name is depends on the type of the object.

generic (short-name object)#
(short-name (object CL-GIT::GIT-OBJECT))
(short-name (object REFERENCE))
(short-name (tag TAG))
(short-name (remote REMOTE))

Returns the short name of OBJECT, as a string.

What exactly the name is depends on the type of the object.


Error conditions can be raised from libgit2 and will be converted into conditions instead of returning NIL values.

GIT> (get-object 'object 1
                 (open-repository #p"/home/russell/projects/ecl/"))
; Raises NOT-FOUND condition

For each of the possible libgit2 errors there is a different condition that will be raised.

class general-error#

Generic error

class not-found-error#

Requested object could not be found

class exists-error#

Object exists preventing operation

class ambiguous-error#

More than one object matches

class buffer-error#

Output buffer too short to hold data

class user-error#

GIT_EUSER is a special error that is never generated by libgit2 code. You can return it from a callback (e.g to stop an iteration) to know that it was generated by the callback and not by libgit2.

class barerepo-error#

Operation not allowed on bare repository

class unborn-branch-error#

HEAD refers to branch with no commits

class unmerged-error#

Merge in progress prevented operation

class non-fast-forward-error#

Reference was not fast-forwardable

class invalid-spec-error#

Name/ref spec was not in a valid format

class conflict-error#

Checkout conflicts prevented operation

class locked-error#

Lock file prevented operation

class modified-error#

Reference value does not match expected

class auth-error#

Authentication error

class certificate-error#

Server certificate is invalid

class applied-error#

Patch/merge has already been applied

class peel-error#

The requested peel operation is not possible

class eof-error#

Unexpected EOF

class invalid-error#

Invalid operation or input

class uncommitted-error#

Uncommitted changes in index prevented operation

class directory-error#

The operation is not valid for a directory

class merge-conflict-error#

A merge conflict exists and cannot continue

class mismatch-error#

Hashsum mismatch in object

class index-dirty-error#

Unsaved changes in the index would be overwritten

class apply-fail-error#

Patch application failedq

Control Flow Errors#

class passthrough#

A user-configured callback refused to act

class stop-iteration#

Signals end of iteration with iterator

class retry#

Internal only