summaryrefslogtreecommitdiff
path: root/notes.c
diff options
context:
space:
mode:
authorJohan Herland <johan@herland.net>2010-02-13 22:28:13 +0100
committerJunio C Hamano <gitster@pobox.com>2010-02-13 19:36:12 -0800
commit2626b5367047d8b8d5c4555ec6b579ed37a6625d (patch)
tree2558dc64ff0f77b00958976c188158f00a105da3 /notes.c
parent709f79b0894859a6624e99b3a0c4714dd4ece494 (diff)
downloadgit-2626b5367047d8b8d5c4555ec6b579ed37a6625d.tar.gz
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>
Diffstat (limited to 'notes.c')
-rw-r--r--notes.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/notes.c b/notes.c
index 3f4ae35340..2c0d14ed8f 100644
--- a/notes.c
+++ b/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);