]> git.proxmox.com Git - libgit2.git/blob - include/git2/signature.h
Merge pull request #409 from nulltoken/ntk/fix/status-tests-segfault
[libgit2.git] / include / git2 / signature.h
1 /*
2 * Copyright (C) 2009-2011 the libgit2 contributors
3 *
4 * This file is part of libgit2, distributed under the GNU GPL v2 with
5 * a Linking Exception. For full terms see the included COPYING file.
6 */
7 #ifndef INCLUDE_git_signature_h__
8 #define INCLUDE_git_signature_h__
9
10 #include "common.h"
11 #include "types.h"
12
13 /**
14 * @file git2/signature.h
15 * @brief Git signature creation
16 * @defgroup git_signature Git signature creation
17 * @ingroup Git
18 * @{
19 */
20 GIT_BEGIN_DECL
21
22 /**
23 * Create a new action signature. The signature must be freed
24 * manually or using git_signature_free
25 *
26 * @param sig_out new signature, in case of error NULL
27 * @param name name of the person
28 * @param email email of the person
29 * @param time time when the action happened
30 * @param offset timezone offset in minutes for the time
31 * @return GIT_SUCCESS or an error code
32 */
33 GIT_EXTERN(int) git_signature_new(git_signature **sig_out, const char *name, const char *email, git_time_t time, int offset);
34
35 /**
36 * Create a new action signature with a timestamp of 'now'. The
37 * signature must be freed manually or using git_signature_free
38 *
39 * @param sig_out new signature, in case of error NULL
40 * @param name name of the person
41 * @param email email of the person
42 * @return GIT_SUCCESS or an error code
43 */
44 GIT_EXTERN(int) git_signature_now(git_signature **sig_out, const char *name, const char *email);
45
46
47 /**
48 * Create a copy of an existing signature.
49 *
50 * All internal strings are also duplicated.
51 * @param sig signature to duplicated
52 * @return a copy of sig, NULL on out of memory
53 */
54 GIT_EXTERN(git_signature *) git_signature_dup(const git_signature *sig);
55
56 /**
57 * Free an existing signature
58 *
59 * @param sig signature to free
60 */
61 GIT_EXTERN(void) git_signature_free(git_signature *sig);
62
63 /** @} */
64 GIT_END_DECL
65 #endif