]> git.proxmox.com Git - libgit2.git/blob - include/git2/signature.h
Merge branch 'cmn/zlib-128' into cmn/zlib-update
[libgit2.git] / include / git2 / signature.h
1 /*
2 * This file is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License, version 2,
4 * as published by the Free Software Foundation.
5 *
6 * In addition to the permissions in the GNU General Public License,
7 * the authors give you unlimited permission to link the compiled
8 * version of this file into combinations with other programs,
9 * and to distribute those combinations without any restriction
10 * coming from the use of this file. (The General Public License
11 * restrictions do apply in other respects; for example, they cover
12 * modification of the file, and distribution when not linked into
13 * a combined executable.)
14 *
15 * This file is distributed in the hope that it will be useful, but
16 * WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; see the file COPYING. If not, write to
22 * the Free Software Foundation, 51 Franklin Street, Fifth Floor,
23 * Boston, MA 02110-1301, USA.
24 */
25 #ifndef INCLUDE_git_signature_h__
26 #define INCLUDE_git_signature_h__
27
28 #include "common.h"
29 #include "types.h"
30
31 /**
32 * @file git2/signature.h
33 * @brief Git signature creation
34 * @defgroup git_signature Git signature creation
35 * @ingroup Git
36 * @{
37 */
38 GIT_BEGIN_DECL
39
40 /**
41 * Create a new action signature. The signature must be freed
42 * manually or using git_signature_free
43 *
44 * @param sig_out new signature, in case of error NULL
45 * @param name name of the person
46 * @param email email of the person
47 * @param time time when the action happened
48 * @param offset timezone offset in minutes for the time
49 * @return 0 on success; error code otherwise
50 */
51 GIT_EXTERN(int) git_signature_new(git_signature **sig_out, const char *name, const char *email, git_time_t time, int offset);
52
53 /**
54 * Create a new action signature with a timestamp of 'now'. The
55 * signature must be freed manually or using git_signature_free
56 *
57 * @param sig_out new signature, in case of error NULL
58 * @param name name of the person
59 * @param email email of the person
60 * @return 0 on success; error code otherwise
61 */
62 GIT_EXTERN(int) git_signature_now(git_signature **sig_out, const char *name, const char *email);
63
64
65 /**
66 * Create a copy of an existing signature.
67 *
68 * All internal strings are also duplicated.
69 * @param sig signature to duplicated
70 * @return a copy of sig, NULL on out of memory
71 */
72 GIT_EXTERN(git_signature *) git_signature_dup(const git_signature *sig);
73
74 /**
75 * Free an existing signature
76 *
77 * @param sig signature to free
78 */
79 GIT_EXTERN(void) git_signature_free(git_signature *sig);
80
81 /** @} */
82 GIT_END_DECL
83 #endif