]>
Commit | Line | Data |
---|---|---|
bf477ed4 MS |
1 | /* |
2 | * Copyright (C) 2009-2012 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_note_h__ | |
8 | #define INCLUDE_git_note_h__ | |
9 | ||
10 | #include "oid.h" | |
11 | ||
12 | /** | |
13 | * @file git2/notes.h | |
14 | * @brief Git notes management routines | |
15 | * @defgroup git_note Git notes management routines | |
16 | * @ingroup Git | |
17 | * @{ | |
18 | */ | |
19 | GIT_BEGIN_DECL | |
20 | ||
21 | /** | |
22 | * Read the note for an object | |
23 | * | |
24 | * The note must be freed manually by the user. | |
25 | * | |
26 | * @param note the note; NULL in case of error | |
27 | * @param repo the Git repository | |
28 | * @param notes_ref OID reference to use (optional); defaults to "refs/notes/commits" | |
29 | * @param oid OID of the object | |
30 | * | |
31 | * @return GIT_SUCCESS or an error code | |
32 | */ | |
33 | GIT_EXTERN(int) git_note_read(git_note **note, git_repository *repo, | |
34 | const char *notes_ref, const git_oid *oid); | |
35 | ||
36 | /** | |
37 | * Get the note message | |
38 | * | |
39 | * @param note | |
40 | * @return the note message | |
41 | */ | |
42 | GIT_EXTERN(const char *) git_note_message(git_note *note); | |
43 | ||
44 | ||
45 | /** | |
46 | * Get the note object OID | |
47 | * | |
48 | * @param note | |
49 | * @return the note object OID | |
50 | */ | |
51 | GIT_EXTERN(const git_oid *) git_note_oid(git_note *note); | |
52 | ||
53 | ||
54 | /** | |
55 | * Add a note for an object | |
56 | * | |
57 | * @param oid pointer to store the OID (optional); NULL in case of error | |
58 | * @param repo the Git repository | |
59 | * @param author signature of the notes commit author | |
60 | * @param committer signature of the notes commit committer | |
61 | * @param notes_ref OID reference to update (optional); defaults to "refs/notes/commits" | |
62 | * @param oid The OID of the object | |
63 | * @param oid The note to add for object oid | |
64 | * | |
65 | * @return GIT_SUCCESS or an error code | |
66 | */ | |
67 | GIT_EXTERN(int) git_note_create(git_oid *out, git_repository *repo, | |
68 | git_signature *author, git_signature *committer, | |
69 | const char *notes_ref, const git_oid *oid, | |
70 | const char *note); | |
71 | ||
72 | ||
73 | /** | |
74 | * Remove the note for an object | |
75 | * | |
76 | * @param repo the Git repository | |
77 | * @param notes_ref OID reference to use (optional); defaults to "refs/notes/commits" | |
78 | * @param author signature of the notes commit author | |
79 | * @param committer signature of the notes commit committer | |
80 | * @param oid the oid which note's to be removed | |
81 | * | |
82 | * @return GIT_SUCCESS or an error code | |
83 | */ | |
84 | GIT_EXTERN(int) git_note_remove(git_repository *repo, const char *notes_ref, | |
85 | git_signature *author, git_signature *committer, | |
86 | const git_oid *oid); | |
87 | ||
88 | /** | |
89 | * Free a git_note object | |
90 | * | |
91 | * @param note git_note object | |
92 | */ | |
93 | GIT_EXTERN(void) git_note_free(git_note *note); | |
94 | ||
630c5a4a MS |
95 | /** |
96 | * Get the default notes reference for a repository | |
97 | * | |
98 | * @param out Pointer to the default notes reference | |
99 | * @param repo The Git repository | |
100 | * | |
101 | * @return GIT_SUCCESS or an error code | |
102 | */ | |
103 | GIT_EXTERN(int) git_note_default_ref(const char **out, git_repository *repo); | |
104 | ||
bf477ed4 MS |
105 | /** @} */ |
106 | GIT_END_DECL | |
107 | #endif |