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