Code

Notes API: init_notes(): Initialize the notes tree from the given notes ref
[git.git] / notes.h
1 #ifndef NOTES_H
2 #define NOTES_H
4 /*
5  * Flags controlling behaviour of notes tree initialization
6  *
7  * Default behaviour is to initialize the notes tree from the tree object
8  * specified by the given (or default) notes ref.
9  */
10 #define NOTES_INIT_EMPTY 1
12 /*
13  * Initialize internal notes tree structure with the notes tree at the given
14  * ref. If given ref is NULL, the value of the $GIT_NOTES_REF environment
15  * variable is used, and if that is missing, the default notes ref is used
16  * ("refs/notes/commits").
17  *
18  * If you need to re-intialize the internal notes tree structure (e.g. loading
19  * from a different notes ref), please first de-initialize the current notes
20  * tree by calling free_notes().
21  */
22 void init_notes(const char *notes_ref, int flags);
24 /* Free (and de-initialize) the internal notes tree structure */
25 void free_notes(void);
27 /* Flags controlling how notes are formatted */
28 #define NOTES_SHOW_HEADER 1
29 #define NOTES_INDENT 2
31 /*
32  * Fill the given strbuf with the notes associated with the given object.
33  *
34  * If the internal notes structure is not initialized, it will be auto-
35  * initialized to the default value (see documentation for init_notes() above).
36  *
37  * 'flags' is a bitwise combination of the above formatting flags.
38  */
39 void format_note(const unsigned char *object_sha1, struct strbuf *sb,
40                 const char *output_encoding, int flags);
42 #endif