Blame include/git2/commit.h

Packit Service 20376f
/*
Packit Service 20376f
 * Copyright (C) the libgit2 contributors. All rights reserved.
Packit Service 20376f
 *
Packit Service 20376f
 * This file is part of libgit2, distributed under the GNU GPL v2 with
Packit Service 20376f
 * a Linking Exception. For full terms see the included COPYING file.
Packit Service 20376f
 */
Packit Service 20376f
#ifndef INCLUDE_git_commit_h__
Packit Service 20376f
#define INCLUDE_git_commit_h__
Packit Service 20376f
Packit Service 20376f
#include "common.h"
Packit Service 20376f
#include "types.h"
Packit Service 20376f
#include "oid.h"
Packit Service 20376f
#include "object.h"
Packit Service 20376f
Packit Service 20376f
/**
Packit Service 20376f
 * @file git2/commit.h
Packit Service 20376f
 * @brief Git commit parsing, formatting routines
Packit Service 20376f
 * @defgroup git_commit Git commit parsing, formatting routines
Packit Service 20376f
 * @ingroup Git
Packit Service 20376f
 * @{
Packit Service 20376f
 */
Packit Service 20376f
GIT_BEGIN_DECL
Packit Service 20376f
Packit Service 20376f
/**
Packit Service 20376f
 * Lookup a commit object from a repository.
Packit Service 20376f
 *
Packit Service 20376f
 * The returned object should be released with `git_commit_free` when no
Packit Service 20376f
 * longer needed.
Packit Service 20376f
 *
Packit Service 20376f
 * @param commit pointer to the looked up commit
Packit Service 20376f
 * @param repo the repo to use when locating the commit.
Packit Service 20376f
 * @param id identity of the commit to locate. If the object is
Packit Service 20376f
 *		an annotated tag it will be peeled back to the commit.
Packit Service 20376f
 * @return 0 or an error code
Packit Service 20376f
 */
Packit Service 20376f
GIT_EXTERN(int) git_commit_lookup(
Packit Service 20376f
	git_commit **commit, git_repository *repo, const git_oid *id);
Packit Service 20376f
Packit Service 20376f
/**
Packit Service 20376f
 * Lookup a commit object from a repository, given a prefix of its
Packit Service 20376f
 * identifier (short id).
Packit Service 20376f
 *
Packit Service 20376f
 * The returned object should be released with `git_commit_free` when no
Packit Service 20376f
 * longer needed.
Packit Service 20376f
 *
Packit Service 20376f
 * @see git_object_lookup_prefix
Packit Service 20376f
 *
Packit Service 20376f
 * @param commit pointer to the looked up commit
Packit Service 20376f
 * @param repo the repo to use when locating the commit.
Packit Service 20376f
 * @param id identity of the commit to locate. If the object is
Packit Service 20376f
 *		an annotated tag it will be peeled back to the commit.
Packit Service 20376f
 * @param len the length of the short identifier
Packit Service 20376f
 * @return 0 or an error code
Packit Service 20376f
 */
Packit Service 20376f
GIT_EXTERN(int) git_commit_lookup_prefix(
Packit Service 20376f
	git_commit **commit, git_repository *repo, const git_oid *id, size_t len);
Packit Service 20376f
Packit Service 20376f
/**
Packit Service 20376f
 * Close an open commit
Packit Service 20376f
 *
Packit Service 20376f
 * This is a wrapper around git_object_free()
Packit Service 20376f
 *
Packit Service 20376f
 * IMPORTANT:
Packit Service 20376f
 * It *is* necessary to call this method when you stop
Packit Service 20376f
 * using a commit. Failure to do so will cause a memory leak.
Packit Service 20376f
 *
Packit Service 20376f
 * @param commit the commit to close
Packit Service 20376f
 */
Packit Service 20376f
Packit Service 20376f
GIT_EXTERN(void) git_commit_free(git_commit *commit);
Packit Service 20376f
Packit Service 20376f
/**
Packit Service 20376f
 * Get the id of a commit.
Packit Service 20376f
 *
Packit Service 20376f
 * @param commit a previously loaded commit.
Packit Service 20376f
 * @return object identity for the commit.
Packit Service 20376f
 */
Packit Service 20376f
GIT_EXTERN(const git_oid *) git_commit_id(const git_commit *commit);
Packit Service 20376f
Packit Service 20376f
/**
Packit Service 20376f
 * Get the repository that contains the commit.
Packit Service 20376f
 *
Packit Service 20376f
 * @param commit A previously loaded commit.
Packit Service 20376f
 * @return Repository that contains this commit.
Packit Service 20376f
 */
Packit Service 20376f
GIT_EXTERN(git_repository *) git_commit_owner(const git_commit *commit);
Packit Service 20376f
Packit Service 20376f
/**
Packit Service 20376f
 * Get the encoding for the message of a commit,
Packit Service 20376f
 * as a string representing a standard encoding name.
Packit Service 20376f
 *
Packit Service 20376f
 * The encoding may be NULL if the `encoding` header
Packit Service 20376f
 * in the commit is missing; in that case UTF-8 is assumed.
Packit Service 20376f
 *
Packit Service 20376f
 * @param commit a previously loaded commit.
Packit Service 20376f
 * @return NULL, or the encoding
Packit Service 20376f
 */
Packit Service 20376f
GIT_EXTERN(const char *) git_commit_message_encoding(const git_commit *commit);
Packit Service 20376f
Packit Service 20376f
/**
Packit Service 20376f
 * Get the full message of a commit.
Packit Service 20376f
 *
Packit Service 20376f
 * The returned message will be slightly prettified by removing any
Packit Service 20376f
 * potential leading newlines.
Packit Service 20376f
 *
Packit Service 20376f
 * @param commit a previously loaded commit.
Packit Service 20376f
 * @return the message of a commit
Packit Service 20376f
 */
Packit Service 20376f
GIT_EXTERN(const char *) git_commit_message(const git_commit *commit);
Packit Service 20376f
Packit Service 20376f
/**
Packit Service 20376f
 * Get the full raw message of a commit.
Packit Service 20376f
 *
Packit Service 20376f
 * @param commit a previously loaded commit.
Packit Service 20376f
 * @return the raw message of a commit
Packit Service 20376f
 */
Packit Service 20376f
GIT_EXTERN(const char *) git_commit_message_raw(const git_commit *commit);
Packit Service 20376f
Packit Service 20376f
/**
Packit Service 20376f
 * Get the short "summary" of the git commit message.
Packit Service 20376f
 *
Packit Service 20376f
 * The returned message is the summary of the commit, comprising the
Packit Service 20376f
 * first paragraph of the message with whitespace trimmed and squashed.
Packit Service 20376f
 *
Packit Service 20376f
 * @param commit a previously loaded commit.
Packit Service 20376f
 * @return the summary of a commit or NULL on error
Packit Service 20376f
 */
Packit Service 20376f
GIT_EXTERN(const char *) git_commit_summary(git_commit *commit);
Packit Service 20376f
Packit Service 20376f
/**
Packit Service 20376f
 * Get the long "body" of the git commit message.
Packit Service 20376f
 *
Packit Service 20376f
 * The returned message is the body of the commit, comprising
Packit Service 20376f
 * everything but the first paragraph of the message. Leading and
Packit Service 20376f
 * trailing whitespaces are trimmed.
Packit Service 20376f
 *
Packit Service 20376f
 * @param commit a previously loaded commit.
Packit Service 20376f
 * @return the body of a commit or NULL when no the message only
Packit Service 20376f
 *   consists of a summary
Packit Service 20376f
 */
Packit Service 20376f
GIT_EXTERN(const char *) git_commit_body(git_commit *commit);
Packit Service 20376f
Packit Service 20376f
/**
Packit Service 20376f
 * Get the commit time (i.e. committer time) of a commit.
Packit Service 20376f
 *
Packit Service 20376f
 * @param commit a previously loaded commit.
Packit Service 20376f
 * @return the time of a commit
Packit Service 20376f
 */
Packit Service 20376f
GIT_EXTERN(git_time_t) git_commit_time(const git_commit *commit);
Packit Service 20376f
Packit Service 20376f
/**
Packit Service 20376f
 * Get the commit timezone offset (i.e. committer's preferred timezone) of a commit.
Packit Service 20376f
 *
Packit Service 20376f
 * @param commit a previously loaded commit.
Packit Service 20376f
 * @return positive or negative timezone offset, in minutes from UTC
Packit Service 20376f
 */
Packit Service 20376f
GIT_EXTERN(int) git_commit_time_offset(const git_commit *commit);
Packit Service 20376f
Packit Service 20376f
/**
Packit Service 20376f
 * Get the committer of a commit.
Packit Service 20376f
 *
Packit Service 20376f
 * @param commit a previously loaded commit.
Packit Service 20376f
 * @return the committer of a commit
Packit Service 20376f
 */
Packit Service 20376f
GIT_EXTERN(const git_signature *) git_commit_committer(const git_commit *commit);
Packit Service 20376f
Packit Service 20376f
/**
Packit Service 20376f
 * Get the author of a commit.
Packit Service 20376f
 *
Packit Service 20376f
 * @param commit a previously loaded commit.
Packit Service 20376f
 * @return the author of a commit
Packit Service 20376f
 */
Packit Service 20376f
GIT_EXTERN(const git_signature *) git_commit_author(const git_commit *commit);
Packit Service 20376f
Packit Service 20376f
/**
Packit Service 20376f
 * Get the full raw text of the commit header.
Packit Service 20376f
 *
Packit Service 20376f
 * @param commit a previously loaded commit
Packit Service 20376f
 * @return the header text of the commit
Packit Service 20376f
 */
Packit Service 20376f
GIT_EXTERN(const char *) git_commit_raw_header(const git_commit *commit);
Packit Service 20376f
Packit Service 20376f
/**
Packit Service 20376f
 * Get the tree pointed to by a commit.
Packit Service 20376f
 *
Packit Service 20376f
 * @param tree_out pointer where to store the tree object
Packit Service 20376f
 * @param commit a previously loaded commit.
Packit Service 20376f
 * @return 0 or an error code
Packit Service 20376f
 */
Packit Service 20376f
GIT_EXTERN(int) git_commit_tree(git_tree **tree_out, const git_commit *commit);
Packit Service 20376f
Packit Service 20376f
/**
Packit Service 20376f
 * Get the id of the tree pointed to by a commit. This differs from
Packit Service 20376f
 * `git_commit_tree` in that no attempts are made to fetch an object
Packit Service 20376f
 * from the ODB.
Packit Service 20376f
 *
Packit Service 20376f
 * @param commit a previously loaded commit.
Packit Service 20376f
 * @return the id of tree pointed to by commit.
Packit Service 20376f
 */
Packit Service 20376f
GIT_EXTERN(const git_oid *) git_commit_tree_id(const git_commit *commit);
Packit Service 20376f
Packit Service 20376f
/**
Packit Service 20376f
 * Get the number of parents of this commit
Packit Service 20376f
 *
Packit Service 20376f
 * @param commit a previously loaded commit.
Packit Service 20376f
 * @return integer of count of parents
Packit Service 20376f
 */
Packit Service 20376f
GIT_EXTERN(unsigned int) git_commit_parentcount(const git_commit *commit);
Packit Service 20376f
Packit Service 20376f
/**
Packit Service 20376f
 * Get the specified parent of the commit.
Packit Service 20376f
 *
Packit Service 20376f
 * @param out Pointer where to store the parent commit
Packit Service 20376f
 * @param commit a previously loaded commit.
Packit Service 20376f
 * @param n the position of the parent (from 0 to `parentcount`)
Packit Service 20376f
 * @return 0 or an error code
Packit Service 20376f
 */
Packit Service 20376f
GIT_EXTERN(int) git_commit_parent(
Packit Service 20376f
	git_commit **out,
Packit Service 20376f
	const git_commit *commit,
Packit Service 20376f
	unsigned int n);
Packit Service 20376f
Packit Service 20376f
/**
Packit Service 20376f
 * Get the oid of a specified parent for a commit. This is different from
Packit Service 20376f
 * `git_commit_parent`, which will attempt to load the parent commit from
Packit Service 20376f
 * the ODB.
Packit Service 20376f
 *
Packit Service 20376f
 * @param commit a previously loaded commit.
Packit Service 20376f
 * @param n the position of the parent (from 0 to `parentcount`)
Packit Service 20376f
 * @return the id of the parent, NULL on error.
Packit Service 20376f
 */
Packit Service 20376f
GIT_EXTERN(const git_oid *) git_commit_parent_id(
Packit Service 20376f
	const git_commit *commit,
Packit Service 20376f
	unsigned int n);
Packit Service 20376f
Packit Service 20376f
/**
Packit Service 20376f
 * Get the commit object that is the <n>th generation ancestor
Packit Service 20376f
 * of the named commit object, following only the first parents.
Packit Service 20376f
 * The returned commit has to be freed by the caller.
Packit Service 20376f
 *
Packit Service 20376f
 * Passing `0` as the generation number returns another instance of the
Packit Service 20376f
 * base commit itself.
Packit Service 20376f
 *
Packit Service 20376f
 * @param ancestor Pointer where to store the ancestor commit
Packit Service 20376f
 * @param commit a previously loaded commit.
Packit Service 20376f
 * @param n the requested generation
Packit Service 20376f
 * @return 0 on success; GIT_ENOTFOUND if no matching ancestor exists
Packit Service 20376f
 * or an error code
Packit Service 20376f
 */
Packit Service 20376f
GIT_EXTERN(int) git_commit_nth_gen_ancestor(
Packit Service 20376f
	git_commit **ancestor,
Packit Service 20376f
	const git_commit *commit,
Packit Service 20376f
	unsigned int n);
Packit Service 20376f
Packit Service 20376f
/**
Packit Service 20376f
 * Get an arbitrary header field
Packit Service 20376f
 *
Packit Service 20376f
 * @param out the buffer to fill; existing content will be
Packit Service 20376f
 * overwritten
Packit Service 20376f
 * @param commit the commit to look in
Packit Service 20376f
 * @param field the header field to return
Packit Service 20376f
 * @return 0 on succeess, GIT_ENOTFOUND if the field does not exist,
Packit Service 20376f
 * or an error code
Packit Service 20376f
 */
Packit Service 20376f
GIT_EXTERN(int) git_commit_header_field(git_buf *out, const git_commit *commit, const char *field);
Packit Service 20376f
Packit Service 20376f
/**
Packit Service 20376f
 * Extract the signature from a commit
Packit Service 20376f
 *
Packit Service 20376f
 * If the id is not for a commit, the error class will be
Packit Service 20376f
 * `GITERR_INVALID`. If the commit does not have a signature, the
Packit Service 20376f
 * error class will be `GITERR_OBJECT`.
Packit Service 20376f
 *
Packit Service 20376f
 * @param signature the signature block; existing content will be
Packit Service 20376f
 * overwritten
Packit Service 20376f
 * @param signed_data signed data; this is the commit contents minus the signature block;
Packit Service 20376f
 * existing content will be overwritten
Packit Service 20376f
 * @param repo the repository in which the commit exists
Packit Service 20376f
 * @param commit_id the commit from which to extract the data
Packit Service 20376f
 * @param field the name of the header field containing the signature
Packit Service 20376f
 * block; pass `NULL` to extract the default 'gpgsig'
Packit Service 20376f
 * @return 0 on success, GIT_ENOTFOUND if the id is not for a commit
Packit Service 20376f
 * or the commit does not have a signature.
Packit Service 20376f
 */
Packit Service 20376f
GIT_EXTERN(int) git_commit_extract_signature(git_buf *signature, git_buf *signed_data, git_repository *repo, git_oid *commit_id, const char *field);
Packit Service 20376f
Packit Service 20376f
/**
Packit Service 20376f
 * Create new commit in the repository from a list of `git_object` pointers
Packit Service 20376f
 *
Packit Service 20376f
 * The message will **not** be cleaned up automatically. You can do that
Packit Service 20376f
 * with the `git_message_prettify()` function.
Packit Service 20376f
 *
Packit Service 20376f
 * @param id Pointer in which to store the OID of the newly created commit
Packit Service 20376f
 *
Packit Service 20376f
 * @param repo Repository where to store the commit
Packit Service 20376f
 *
Packit Service 20376f
 * @param update_ref If not NULL, name of the reference that
Packit Service 20376f
 *	will be updated to point to this commit. If the reference
Packit Service 20376f
 *	is not direct, it will be resolved to a direct reference.
Packit Service 20376f
 *	Use "HEAD" to update the HEAD of the current branch and
Packit Service 20376f
 *	make it point to this commit. If the reference doesn't
Packit Service 20376f
 *	exist yet, it will be created. If it does exist, the first
Packit Service 20376f
 *	parent must be the tip of this branch.
Packit Service 20376f
 *
Packit Service 20376f
 * @param author Signature with author and author time of commit
Packit Service 20376f
 *
Packit Service 20376f
 * @param committer Signature with committer and * commit time of commit
Packit Service 20376f
 *
Packit Service 20376f
 * @param message_encoding The encoding for the message in the
Packit Service 20376f
 *  commit, represented with a standard encoding name.
Packit Service 20376f
 *  E.g. "UTF-8". If NULL, no encoding header is written and
Packit Service 20376f
 *  UTF-8 is assumed.
Packit Service 20376f
 *
Packit Service 20376f
 * @param message Full message for this commit
Packit Service 20376f
 *
Packit Service 20376f
 * @param tree An instance of a `git_tree` object that will
Packit Service 20376f
 *  be used as the tree for the commit. This tree object must
Packit Service 20376f
 *  also be owned by the given `repo`.
Packit Service 20376f
 *
Packit Service 20376f
 * @param parent_count Number of parents for this commit
Packit Service 20376f
 *
Packit Service 20376f
 * @param parents Array of `parent_count` pointers to `git_commit`
Packit Service 20376f
 *  objects that will be used as the parents for this commit. This
Packit Service 20376f
 *  array may be NULL if `parent_count` is 0 (root commit). All the
Packit Service 20376f
 *  given commits must be owned by the `repo`.
Packit Service 20376f
 *
Packit Service 20376f
 * @return 0 or an error code
Packit Service 20376f
 *	The created commit will be written to the Object Database and
Packit Service 20376f
 *	the given reference will be updated to point to it
Packit Service 20376f
 */
Packit Service 20376f
GIT_EXTERN(int) git_commit_create(
Packit Service 20376f
	git_oid *id,
Packit Service 20376f
	git_repository *repo,
Packit Service 20376f
	const char *update_ref,
Packit Service 20376f
	const git_signature *author,
Packit Service 20376f
	const git_signature *committer,
Packit Service 20376f
	const char *message_encoding,
Packit Service 20376f
	const char *message,
Packit Service 20376f
	const git_tree *tree,
Packit Service 20376f
	size_t parent_count,
Packit Service 20376f
	const git_commit *parents[]);
Packit Service 20376f
Packit Service 20376f
/**
Packit Service 20376f
 * Create new commit in the repository using a variable argument list.
Packit Service 20376f
 *
Packit Service 20376f
 * The message will **not** be cleaned up automatically. You can do that
Packit Service 20376f
 * with the `git_message_prettify()` function.
Packit Service 20376f
 *
Packit Service 20376f
 * The parents for the commit are specified as a variable list of pointers
Packit Service 20376f
 * to `const git_commit *`. Note that this is a convenience method which may
Packit Service 20376f
 * not be safe to export for certain languages or compilers
Packit Service 20376f
 *
Packit Service 20376f
 * All other parameters remain the same as `git_commit_create()`.
Packit Service 20376f
 *
Packit Service 20376f
 * @see git_commit_create
Packit Service 20376f
 */
Packit Service 20376f
GIT_EXTERN(int) git_commit_create_v(
Packit Service 20376f
	git_oid *id,
Packit Service 20376f
	git_repository *repo,
Packit Service 20376f
	const char *update_ref,
Packit Service 20376f
	const git_signature *author,
Packit Service 20376f
	const git_signature *committer,
Packit Service 20376f
	const char *message_encoding,
Packit Service 20376f
	const char *message,
Packit Service 20376f
	const git_tree *tree,
Packit Service 20376f
	size_t parent_count,
Packit Service 20376f
	...);
Packit Service 20376f
Packit Service 20376f
/**
Packit Service 20376f
 * Amend an existing commit by replacing only non-NULL values.
Packit Service 20376f
 *
Packit Service 20376f
 * This creates a new commit that is exactly the same as the old commit,
Packit Service 20376f
 * except that any non-NULL values will be updated.  The new commit has
Packit Service 20376f
 * the same parents as the old commit.
Packit Service 20376f
 *
Packit Service 20376f
 * The `update_ref` value works as in the regular `git_commit_create()`,
Packit Service 20376f
 * updating the ref to point to the newly rewritten commit.  If you want
Packit Service 20376f
 * to amend a commit that is not currently the tip of the branch and then
Packit Service 20376f
 * rewrite the following commits to reach a ref, pass this as NULL and
Packit Service 20376f
 * update the rest of the commit chain and ref separately.
Packit Service 20376f
 *
Packit Service 20376f
 * Unlike `git_commit_create()`, the `author`, `committer`, `message`,
Packit Service 20376f
 * `message_encoding`, and `tree` parameters can be NULL in which case this
Packit Service 20376f
 * will use the values from the original `commit_to_amend`.
Packit Service 20376f
 *
Packit Service 20376f
 * All parameters have the same meanings as in `git_commit_create()`.
Packit Service 20376f
 *
Packit Service 20376f
 * @see git_commit_create
Packit Service 20376f
 */
Packit Service 20376f
GIT_EXTERN(int) git_commit_amend(
Packit Service 20376f
	git_oid *id,
Packit Service 20376f
	const git_commit *commit_to_amend,
Packit Service 20376f
	const char *update_ref,
Packit Service 20376f
	const git_signature *author,
Packit Service 20376f
	const git_signature *committer,
Packit Service 20376f
	const char *message_encoding,
Packit Service 20376f
	const char *message,
Packit Service 20376f
	const git_tree *tree);
Packit Service 20376f
Packit Service 20376f
/**
Packit Service 20376f
 * Create a commit and write it into a buffer
Packit Service 20376f
 *
Packit Service 20376f
 * Create a commit as with `git_commit_create()` but instead of
Packit Service 20376f
 * writing it to the objectdb, write the contents of the object into a
Packit Service 20376f
 * buffer.
Packit Service 20376f
 *
Packit Service 20376f
 * @param out the buffer into which to write the commit object content
Packit Service 20376f
 *
Packit Service 20376f
 * @param repo Repository where the referenced tree and parents live
Packit Service 20376f
 *
Packit Service 20376f
 * @param author Signature with author and author time of commit
Packit Service 20376f
 *
Packit Service 20376f
 * @param committer Signature with committer and * commit time of commit
Packit Service 20376f
 *
Packit Service 20376f
 * @param message_encoding The encoding for the message in the
Packit Service 20376f
 *  commit, represented with a standard encoding name.
Packit Service 20376f
 *  E.g. "UTF-8". If NULL, no encoding header is written and
Packit Service 20376f
 *  UTF-8 is assumed.
Packit Service 20376f
 *
Packit Service 20376f
 * @param message Full message for this commit
Packit Service 20376f
 *
Packit Service 20376f
 * @param tree An instance of a `git_tree` object that will
Packit Service 20376f
 *  be used as the tree for the commit. This tree object must
Packit Service 20376f
 *  also be owned by the given `repo`.
Packit Service 20376f
 *
Packit Service 20376f
 * @param parent_count Number of parents for this commit
Packit Service 20376f
 *
Packit Service 20376f
 * @param parents Array of `parent_count` pointers to `git_commit`
Packit Service 20376f
 *  objects that will be used as the parents for this commit. This
Packit Service 20376f
 *  array may be NULL if `parent_count` is 0 (root commit). All the
Packit Service 20376f
 *  given commits must be owned by the `repo`.
Packit Service 20376f
 *
Packit Service 20376f
 * @return 0 or an error code
Packit Service 20376f
 */
Packit Service 20376f
GIT_EXTERN(int) git_commit_create_buffer(
Packit Service 20376f
	git_buf *out,
Packit Service 20376f
	git_repository *repo,
Packit Service 20376f
	const git_signature *author,
Packit Service 20376f
	const git_signature *committer,
Packit Service 20376f
	const char *message_encoding,
Packit Service 20376f
	const char *message,
Packit Service 20376f
	const git_tree *tree,
Packit Service 20376f
	size_t parent_count,
Packit Service 20376f
	const git_commit *parents[]);
Packit Service 20376f
Packit Service 20376f
/**
Packit Service 20376f
 * Create a commit object from the given buffer and signature
Packit Service 20376f
 *
Packit Service 20376f
 * Given the unsigned commit object's contents, its signature and the
Packit Service 20376f
 * header field in which to store the signature, attach the signature
Packit Service 20376f
 * to the commit and write it into the given repository.
Packit Service 20376f
 *
Packit Service 20376f
 * @param out the resulting commit id
Packit Service 20376f
 * @param commit_content the content of the unsigned commit object
Packit Service 20376f
 * @param signature the signature to add to the commit
Packit Service 20376f
 * @param signature_field which header field should contain this
Packit Service 20376f
 * signature. Leave `NULL` for the default of "gpgsig"
Packit Service 20376f
 * @return 0 or an error code
Packit Service 20376f
 */
Packit Service 20376f
GIT_EXTERN(int) git_commit_create_with_signature(
Packit Service 20376f
	git_oid *out,
Packit Service 20376f
	git_repository *repo,
Packit Service 20376f
	const char *commit_content,
Packit Service 20376f
	const char *signature,
Packit Service 20376f
	const char *signature_field);
Packit Service 20376f
Packit Service 20376f
/**
Packit Service 20376f
 * Create an in-memory copy of a commit. The copy must be explicitly
Packit Service 20376f
 * free'd or it will leak.
Packit Service 20376f
 *
Packit Service 20376f
 * @param out Pointer to store the copy of the commit
Packit Service 20376f
 * @param source Original commit to copy
Packit Service 20376f
 */
Packit Service 20376f
GIT_EXTERN(int) git_commit_dup(git_commit **out, git_commit *source);
Packit Service 20376f
Packit Service 20376f
/** @} */
Packit Service 20376f
GIT_END_DECL
Packit Service 20376f
#endif