зеркало из https://github.com/microsoft/git.git
Notes API: add_note(): Add note objects to the internal notes tree structure
Signed-off-by: Johan Herland <johan@herland.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Родитель
709f79b089
Коммит
2626b53670
11
notes.c
11
notes.c
|
@ -368,6 +368,17 @@ void init_notes(const char *notes_ref, int flags)
|
|||
load_subtree(&root_tree, &root_node, 0);
|
||||
}
|
||||
|
||||
void add_note(const unsigned char *object_sha1, const unsigned char *note_sha1)
|
||||
{
|
||||
struct leaf_node *l;
|
||||
|
||||
assert(initialized);
|
||||
l = (struct leaf_node *) xmalloc(sizeof(struct leaf_node));
|
||||
hashcpy(l->key_sha1, object_sha1);
|
||||
hashcpy(l->val_sha1, note_sha1);
|
||||
note_tree_insert(&root_node, 0, l, PTR_TYPE_NOTE);
|
||||
}
|
||||
|
||||
static unsigned char *lookup_notes(const unsigned char *object_sha1)
|
||||
{
|
||||
struct leaf_node *found = note_tree_find(&root_node, 0, object_sha1);
|
||||
|
|
4
notes.h
4
notes.h
|
@ -21,6 +21,10 @@
|
|||
*/
|
||||
void init_notes(const char *notes_ref, int flags);
|
||||
|
||||
/* Add the given note object to the internal notes tree structure */
|
||||
void add_note(const unsigned char *object_sha1,
|
||||
const unsigned char *note_sha1);
|
||||
|
||||
/* Free (and de-initialize) the internal notes tree structure */
|
||||
void free_notes(void);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче