Blame include/git2/annotated_commit.h

Packit ae9e2a
/*
Packit ae9e2a
 * Copyright (C) the libgit2 contributors. All rights reserved.
Packit ae9e2a
 *
Packit ae9e2a
 * This file is part of libgit2, distributed under the GNU GPL v2 with
Packit ae9e2a
 * a Linking Exception. For full terms see the included COPYING file.
Packit ae9e2a
 */
Packit ae9e2a
#ifndef INCLUDE_git_annotated_commit_h__
Packit ae9e2a
#define INCLUDE_git_annotated_commit_h__
Packit ae9e2a
Packit ae9e2a
#include "common.h"
Packit ae9e2a
#include "repository.h"
Packit ae9e2a
#include "types.h"
Packit ae9e2a
Packit ae9e2a
/**
Packit ae9e2a
 * @file git2/annotated_commit.h
Packit ae9e2a
 * @brief Git annotated commit routines
Packit ae9e2a
 * @defgroup git_annotated_commit Git annotated commit routines
Packit ae9e2a
 * @ingroup Git
Packit ae9e2a
 * @{
Packit ae9e2a
 */
Packit ae9e2a
GIT_BEGIN_DECL
Packit ae9e2a
Packit ae9e2a
/**
Packit ae9e2a
 * Creates a `git_annotated_commit` from the given reference.
Packit ae9e2a
 * The resulting git_annotated_commit must be freed with
Packit ae9e2a
 * `git_annotated_commit_free`.
Packit ae9e2a
 *
Packit ae9e2a
 * @param out pointer to store the git_annotated_commit result in
Packit ae9e2a
 * @param repo repository that contains the given reference
Packit ae9e2a
 * @param ref reference to use to lookup the git_annotated_commit
Packit ae9e2a
 * @return 0 on success or error code
Packit ae9e2a
 */
Packit ae9e2a
GIT_EXTERN(int) git_annotated_commit_from_ref(
Packit ae9e2a
	git_annotated_commit **out,
Packit ae9e2a
	git_repository *repo,
Packit ae9e2a
	const git_reference *ref);
Packit ae9e2a
Packit ae9e2a
/**
Packit ae9e2a
 * Creates a `git_annotated_commit` from the given fetch head data.
Packit ae9e2a
 * The resulting git_annotated_commit must be freed with
Packit ae9e2a
 * `git_annotated_commit_free`.
Packit ae9e2a
 *
Packit ae9e2a
 * @param out pointer to store the git_annotated_commit result in
Packit ae9e2a
 * @param repo repository that contains the given commit
Packit ae9e2a
 * @param branch_name name of the (remote) branch
Packit ae9e2a
 * @param remote_url url of the remote
Packit ae9e2a
 * @param id the commit object id of the remote branch
Packit ae9e2a
 * @return 0 on success or error code
Packit ae9e2a
 */
Packit ae9e2a
GIT_EXTERN(int) git_annotated_commit_from_fetchhead(
Packit ae9e2a
	git_annotated_commit **out,
Packit ae9e2a
	git_repository *repo,
Packit ae9e2a
	const char *branch_name,
Packit ae9e2a
	const char *remote_url,
Packit ae9e2a
	const git_oid *id);
Packit ae9e2a
Packit ae9e2a
/**
Packit ae9e2a
 * Creates a `git_annotated_commit` from the given commit id.
Packit ae9e2a
 * The resulting git_annotated_commit must be freed with
Packit ae9e2a
 * `git_annotated_commit_free`.
Packit ae9e2a
 *
Packit ae9e2a
 * An annotated commit contains information about how it was
Packit ae9e2a
 * looked up, which may be useful for functions like merge or
Packit ae9e2a
 * rebase to provide context to the operation.  For example,
Packit ae9e2a
 * conflict files will include the name of the source or target
Packit ae9e2a
 * branches being merged.  It is therefore preferable to use the
Packit ae9e2a
 * most specific function (eg `git_annotated_commit_from_ref`)
Packit ae9e2a
 * instead of this one when that data is known.
Packit ae9e2a
 *
Packit ae9e2a
 * @param out pointer to store the git_annotated_commit result in
Packit ae9e2a
 * @param repo repository that contains the given commit
Packit ae9e2a
 * @param id the commit object id to lookup
Packit ae9e2a
 * @return 0 on success or error code
Packit ae9e2a
 */
Packit ae9e2a
GIT_EXTERN(int) git_annotated_commit_lookup(
Packit ae9e2a
	git_annotated_commit **out,
Packit ae9e2a
	git_repository *repo,
Packit ae9e2a
	const git_oid *id);
Packit ae9e2a
Packit ae9e2a
/**
Packit ae9e2a
 * Creates a `git_annotated_comit` from a revision string.
Packit ae9e2a
 *
Packit ae9e2a
 * See `man gitrevisions`, or
Packit ae9e2a
 * http://git-scm.com/docs/git-rev-parse.html#_specifying_revisions for
Packit ae9e2a
 * information on the syntax accepted.
Packit ae9e2a
 *
Packit ae9e2a
 * @param out pointer to store the git_annotated_commit result in
Packit ae9e2a
 * @param repo repository that contains the given commit
Packit ae9e2a
 * @param revspec the extended sha syntax string to use to lookup the commit
Packit ae9e2a
 * @return 0 on success or error code
Packit ae9e2a
 */
Packit ae9e2a
GIT_EXTERN(int) git_annotated_commit_from_revspec(
Packit ae9e2a
	git_annotated_commit **out,
Packit ae9e2a
	git_repository *repo,
Packit ae9e2a
	const char *revspec);
Packit ae9e2a
Packit ae9e2a
/**
Packit ae9e2a
 * Gets the commit ID that the given `git_annotated_commit` refers to.
Packit ae9e2a
 *
Packit ae9e2a
 * @param commit the given annotated commit
Packit ae9e2a
 * @return commit id
Packit ae9e2a
 */
Packit ae9e2a
GIT_EXTERN(const git_oid *) git_annotated_commit_id(
Packit ae9e2a
	const git_annotated_commit *commit);
Packit ae9e2a
Packit ae9e2a
/**
Packit ae9e2a
 * Frees a `git_annotated_commit`.
Packit ae9e2a
 *
Packit ae9e2a
 * @param commit annotated commit to free
Packit ae9e2a
 */
Packit ae9e2a
GIT_EXTERN(void) git_annotated_commit_free(
Packit ae9e2a
	git_annotated_commit *commit);
Packit ae9e2a
Packit ae9e2a
/** @} */
Packit ae9e2a
GIT_END_DECL
Packit ae9e2a
#endif