Commit a02e7249 by yorah

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
parent b0b3b4e3
......@@ -179,3 +179,36 @@ void test_notes_notes__can_correctly_insert_a_note_in_an_existing_fanout(void)
git_oid_cpy(&target_oid, &note_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(&note, _repo, "refs/notes/fanout", &target_oid));
cl_git_pass(git_oid_fromstr(&note_oid, "08b041783f40edfe12bb406c9c9a8a040177c125"));
cl_assert(!git_oid_cmp(git_note_oid(note), &note_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(&note, _repo, "refs/notes/fanout", &target_oid));
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment