diff options
author | yorah <yoram.harmelin@gmail.com> | 2012-05-29 17:53:29 +0200 |
---|---|---|
committer | yorah <yoram.harmelin@gmail.com> | 2012-06-08 20:34:24 +0200 |
commit | a02e7249784d8aa8c7c89329c4ec68a54ccab92c (patch) | |
tree | 117e9a4b398e7f489419f27f58f866394e68ee89 /tests-clar/notes/notes.c | |
parent | b0b3b4e39e372c29af6782bdee8ec1a87ff662dd (diff) | |
download | libgit2-a02e7249784d8aa8c7c89329c4ec68a54ccab92c.tar.gz |
notes: simplify the handling of fanouts
- Do not create new levels of fanout when creating notes from libgit2
- Insert a note in an existing matching fanout
- Remove a note from an existing fanout
- Cleanup git_note_read, git_note_remove, git_note_foreach, git_note_create methods in order use tree structures instead of tree_oids
Diffstat (limited to 'tests-clar/notes/notes.c')
-rw-r--r-- | tests-clar/notes/notes.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/tests-clar/notes/notes.c b/tests-clar/notes/notes.c index d79c21165..068e44c5f 100644 --- a/tests-clar/notes/notes.c +++ b/tests-clar/notes/notes.c @@ -179,3 +179,36 @@ void test_notes_notes__can_correctly_insert_a_note_in_an_existing_fanout(void) git_oid_cpy(&target_oid, ¬e_oid); } } + +/* + * $ git notes --ref fanout list 8496071c1b46c854b31185ea97743be6a8774479 + * 08b041783f40edfe12bb406c9c9a8a040177c125 + */ +void test_notes_notes__can_read_a_note_in_an_existing_fanout(void) +{ + git_oid note_oid, target_oid; + git_note *note; + + cl_git_pass(git_oid_fromstr(&target_oid, "8496071c1b46c854b31185ea97743be6a8774479")); + cl_git_pass(git_note_read(¬e, _repo, "refs/notes/fanout", &target_oid)); + + cl_git_pass(git_oid_fromstr(¬e_oid, "08b041783f40edfe12bb406c9c9a8a040177c125")); + cl_assert(!git_oid_cmp(git_note_oid(note), ¬e_oid)); + + git_note_free(note); +} + +/* + * $ git notes --ref fanout list 8496071c1b46c854b31185ea97743be6a8774479 + * 08b041783f40edfe12bb406c9c9a8a040177c125 + */ +void test_notes_notes__can_remove_a_note_in_an_existing_fanout(void) +{ + git_oid target_oid; + git_note *note; + + cl_git_pass(git_oid_fromstr(&target_oid, "8496071c1b46c854b31185ea97743be6a8774479")); + cl_git_pass(git_note_remove(_repo, "refs/notes/fanout", _sig, _sig, &target_oid)); + + cl_git_fail(git_note_read(¬e, _repo, "refs/notes/fanout", &target_oid)); +} |