libgit2

git_commit_create_from_callback

Version:

Create a new commit in the repository with an callback to supply parents.

See documentation for git_commit_create() for information about the parameters, as the meaning is identical excepting that tree takes a git_oid and doesn't check for validity, and parent_cb is invoked with parent_payload and should return git_oid values or NULL to indicate that all parents are accounted for.

Signature

int git_commit_create_from_callback(git_oid *id, git_repository *repo, const char *update_ref, const git_signature *author, const git_signature *committer, const char *message_encoding, const char *message, const git_oid *tree, git_commit_parent_callback parent_cb, void *parent_payload);

Parameters

In
id

Pointer in which to store the OID of the newly created commit

In
repo

Repository where to store the commit

const char *
In
update_ref

If not NULL, name of the reference that will be updated to point to this commit. If the reference is not direct, it will be resolved to a direct reference. Use "HEAD" to update the HEAD of the current branch and make it point to this commit. If the reference doesn't exist yet, it will be created. If it does exist, the first parent must be the tip of this branch.

In
author

Signature with author and author time of commit

In
committer

Signature with committer and * commit time of commit

const char *
In
message_encoding

The encoding for the message in the commit, represented with a standard encoding name. E.g. "UTF-8". If NULL, no encoding header is written and UTF-8 is assumed.

const char *
In
message

Full message for this commit

In
tree

An instance of a git_tree object that will be used as the tree for the commit. This tree object must also be owned by the given repo.

In
parent_cb

Callback to invoke to obtain parent information

void *
In
parent_payload

User-specified payload to provide to the callback

Returns

int

0 or an error code The created commit will be written to the Object Database and the given reference will be updated to point to it

Versions