Git-Raw
view release on metacpan or search on metacpan
deps/libgit2/include/git2/commit.h view on Meta::CPAN
unsigned int n);
/**
* Get the oid of a specified parent for a commit. This is different from
* `git_commit_parent`, which will attempt to load the parent commit from
* the ODB.
*
* @param commit a previously loaded commit.
* @param n the position of the parent (from 0 to `parentcount`)
* @return the id of the parent, NULL on error.
*/
GIT_EXTERN(const git_oid *) git_commit_parent_id(
const git_commit *commit,
unsigned int n);
/**
* Get the commit object that is the <n>th generation ancestor
* of the named commit object, following only the first parents.
* The returned commit has to be freed by the caller.
*
* Passing `0` as the generation number returns another instance of the
* base commit itself.
*
* @param ancestor Pointer where to store the ancestor commit
* @param commit a previously loaded commit.
* @param n the requested generation
* @return 0 on success; GIT_ENOTFOUND if no matching ancestor exists
* or an error code
*/
GIT_EXTERN(int) git_commit_nth_gen_ancestor(
git_commit **ancestor,
const git_commit *commit,
unsigned int n);
/**
* Get an arbitrary header field
*
* @param out the buffer to fill; existing content will be
* overwritten
* @param commit the commit to look in
* @param field the header field to return
* @return 0 on succeess, GIT_ENOTFOUND if the field does not exist,
* or an error code
*/
GIT_EXTERN(int) git_commit_header_field(git_buf *out, const git_commit *commit, const char *field);
/**
* Extract the signature from a commit
*
* If the id is not for a commit, the error class will be
* `GIT_ERROR_INVALID`. If the commit does not have a signature, the
* error class will be `GIT_ERROR_OBJECT`.
*
* @param signature the signature block; existing content will be
* overwritten
* @param signed_data signed data; this is the commit contents minus the signature block;
* existing content will be overwritten
* @param repo the repository in which the commit exists
* @param commit_id the commit from which to extract the data
* @param field the name of the header field containing the signature
* block; pass `NULL` to extract the default 'gpgsig'
* @return 0 on success, GIT_ENOTFOUND if the id is not for a commit
* or the commit does not have a signature.
*/
GIT_EXTERN(int) git_commit_extract_signature(git_buf *signature, git_buf *signed_data, git_repository *repo, git_oid *commit_id, const char *field);
/**
* Create new commit in the repository from a list of `git_object` pointers
*
* The message will **not** be cleaned up automatically. You can do that
* with the `git_message_prettify()` function.
*
* @param id Pointer in which to store the OID of the newly created commit
*
* @param repo Repository where to store the commit
*
* @param 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.
*
* @param author Signature with author and author time of commit
*
* @param committer Signature with committer and * commit time of commit
*
* @param 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.
*
* @param message Full message for this commit
*
* @param 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`.
*
* @param parent_count Number of parents for this commit
*
* @param parents Array of `parent_count` pointers to `git_commit`
* objects that will be used as the parents for this commit. This
* array may be NULL if `parent_count` is 0 (root commit). All the
* given commits must be owned by the `repo`.
*
* @return 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
*/
GIT_EXTERN(int) git_commit_create(
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_tree *tree,
size_t parent_count,
const git_commit *parents[]);
deps/libgit2/include/git2/commit.h view on Meta::CPAN
/**
* Create a commit and write it into a buffer
*
* Create a commit as with `git_commit_create()` but instead of
* writing it to the objectdb, write the contents of the object into a
* buffer.
*
* @param out the buffer into which to write the commit object content
*
* @param repo Repository where the referenced tree and parents live
*
* @param author Signature with author and author time of commit
*
* @param committer Signature with committer and * commit time of commit
*
* @param 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.
*
* @param message Full message for this commit
*
* @param 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`.
*
* @param parent_count Number of parents for this commit
*
* @param parents Array of `parent_count` pointers to `git_commit`
* objects that will be used as the parents for this commit. This
* array may be NULL if `parent_count` is 0 (root commit). All the
* given commits must be owned by the `repo`.
*
* @return 0 or an error code
*/
GIT_EXTERN(int) git_commit_create_buffer(
git_buf *out,
git_repository *repo,
const git_signature *author,
const git_signature *committer,
const char *message_encoding,
const char *message,
const git_tree *tree,
size_t parent_count,
const git_commit *parents[]);
/**
* Create a commit object from the given buffer and signature
*
* Given the unsigned commit object's contents, its signature and the
* header field in which to store the signature, attach the signature
* to the commit and write it into the given repository.
*
* @param out the resulting commit id
* @param repo the repository to create the commit in.
* @param commit_content the content of the unsigned commit object
* @param signature the signature to add to the commit. Leave `NULL`
* to create a commit without adding a signature field.
* @param signature_field which header field should contain this
* signature. Leave `NULL` for the default of "gpgsig"
* @return 0 or an error code
*/
GIT_EXTERN(int) git_commit_create_with_signature(
git_oid *out,
git_repository *repo,
const char *commit_content,
const char *signature,
const char *signature_field);
/**
* Create an in-memory copy of a commit. The copy must be explicitly
* free'd or it will leak.
*
* @param out Pointer to store the copy of the commit
* @param source Original commit to copy
* @return 0
*/
GIT_EXTERN(int) git_commit_dup(git_commit **out, git_commit *source);
/**
* Commit creation callback: used when a function is going to create
* commits (for example, in `git_rebase_commit`) to allow callers to
* override the commit creation behavior. For example, users may
* wish to sign commits by providing this information to
* `git_commit_create_buffer`, signing that buffer, then calling
* `git_commit_create_with_signature`. The resultant commit id
* should be set in the `out` object id parameter.
*
* @param out pointer that this callback will populate with the object
* id of the commit that is created
* @param author the author name and time of the commit
* @param committer the committer name and time of the commit
* @param message_encoding the encoding of the given message, or NULL
* to assume UTF8
* @param message the commit message
* @param tree the tree to be committed
* @param parent_count the number of parents for this commit
* @param parents the commit parents
* @param payload the payload pointer in the rebase options
* @return 0 if this callback has created the commit and populated the out
* parameter, GIT_PASSTHROUGH if the callback has not created a
* commit and wants the calling function to create the commit as
* if no callback had been specified, any other value to stop
* and return a failure
*/
typedef int (*git_commit_create_cb)(
git_oid *out,
const git_signature *author,
const git_signature *committer,
const char *message_encoding,
const char *message,
const git_tree *tree,
size_t parent_count,
const git_commit *parents[],
void *payload);
/** @} */
GIT_END_DECL
#endif
( run in 1.751 second using v1.01-cache-2.11-cpan-df04353d9ac )