Blame include/git2/signature.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_signature_h__
Packit Service 20376f
#define INCLUDE_git_signature_h__
Packit Service 20376f
Packit Service 20376f
#include "common.h"
Packit Service 20376f
#include "types.h"
Packit Service 20376f
Packit Service 20376f
/**
Packit Service 20376f
 * @file git2/signature.h
Packit Service 20376f
 * @brief Git signature creation
Packit Service 20376f
 * @defgroup git_signature Git signature creation
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
 * Create a new action signature.
Packit Service 20376f
 *
Packit Service 20376f
 * Call `git_signature_free()` to free the data.
Packit Service 20376f
 *
Packit Service 20376f
 * Note: angle brackets ('<' and '>') characters are not allowed
Packit Service 20376f
 * to be used in either the `name` or the `email` parameter.
Packit Service 20376f
 *
Packit Service 20376f
 * @param out new signature, in case of error NULL
Packit Service 20376f
 * @param name name of the person
Packit Service 20376f
 * @param email email of the person
Packit Service 20376f
 * @param time time when the action happened
Packit Service 20376f
 * @param offset timezone offset in minutes for the time
Packit Service 20376f
 * @return 0 or an error code
Packit Service 20376f
 */
Packit Service 20376f
GIT_EXTERN(int) git_signature_new(git_signature **out, const char *name, const char *email, git_time_t time, int offset);
Packit Service 20376f
Packit Service 20376f
/**
Packit Service 20376f
 * Create a new action signature with a timestamp of 'now'.
Packit Service 20376f
 *
Packit Service 20376f
 * Call `git_signature_free()` to free the data.
Packit Service 20376f
 *
Packit Service 20376f
 * @param out new signature, in case of error NULL
Packit Service 20376f
 * @param name name of the person
Packit Service 20376f
 * @param email email of the person
Packit Service 20376f
 * @return 0 or an error code
Packit Service 20376f
 */
Packit Service 20376f
GIT_EXTERN(int) git_signature_now(git_signature **out, const char *name, const char *email);
Packit Service 20376f
Packit Service 20376f
/**
Packit Service 20376f
 * Create a new action signature with default user and now timestamp.
Packit Service 20376f
 *
Packit Service 20376f
 * This looks up the user.name and user.email from the configuration and
Packit Service 20376f
 * uses the current time as the timestamp, and creates a new signature
Packit Service 20376f
 * based on that information.  It will return GIT_ENOTFOUND if either the
Packit Service 20376f
 * user.name or user.email are not set.
Packit Service 20376f
 *
Packit Service 20376f
 * @param out new signature
Packit Service 20376f
 * @param repo repository pointer
Packit Service 20376f
 * @return 0 on success, GIT_ENOTFOUND if config is missing, or error code
Packit Service 20376f
 */
Packit Service 20376f
GIT_EXTERN(int) git_signature_default(git_signature **out, git_repository *repo);
Packit Service 20376f
Packit Service 20376f
/**
Packit Service 20376f
 * Create a new signature by parsing the given buffer, which is
Packit Service 20376f
 * expected to be in the format "Real Name <email> timestamp tzoffset",
Packit Service 20376f
 * where `timestamp` is the number of seconds since the Unix epoch and
Packit Service 20376f
 * `tzoffset` is the timezone offset in `hhmm` format (note the lack
Packit Service 20376f
 * of a colon separator).
Packit Service 20376f
 *
Packit Service 20376f
 * @param out new signature
Packit Service 20376f
 * @param buf signature string
Packit Service 20376f
 * @return 0 on success, or an error code
Packit Service 20376f
 */
Packit Service 20376f
GIT_EXTERN(int) git_signature_from_buffer(git_signature **out, const char *buf);
Packit Service 20376f
Packit Service 20376f
/**
Packit Service 20376f
 * Create a copy of an existing signature.  All internal strings are also
Packit Service 20376f
 * duplicated.
Packit Service 20376f
 *
Packit Service 20376f
 * Call `git_signature_free()` to free the data.
Packit Service 20376f
 *
Packit Service 20376f
 * @param dest pointer where to store the copy
Packit Service 20376f
 * @param sig signature to duplicate
Packit Service 20376f
 * @return 0 or an error code
Packit Service 20376f
 */
Packit Service 20376f
GIT_EXTERN(int) git_signature_dup(git_signature **dest, const git_signature *sig);
Packit Service 20376f
Packit Service 20376f
/**
Packit Service 20376f
 * Free an existing signature.
Packit Service 20376f
 *
Packit Service 20376f
 * Because the signature is not an opaque structure, it is legal to free it
Packit Service 20376f
 * manually, but be sure to free the "name" and "email" strings in addition
Packit Service 20376f
 * to the structure itself.
Packit Service 20376f
 *
Packit Service 20376f
 * @param sig signature to free
Packit Service 20376f
 */
Packit Service 20376f
GIT_EXTERN(void) git_signature_free(git_signature *sig);
Packit Service 20376f
Packit Service 20376f
/** @} */
Packit Service 20376f
GIT_END_DECL
Packit Service 20376f
#endif