Commit 1a90dcf6 by Nico von Geyso

use git_note_iterator type instead of non-public git_iterator one

parent 6edb427b
......@@ -32,7 +32,7 @@ typedef int (*git_note_foreach_cb)(
/**
* note iterator
*/
typedef struct git_iterator git_iterator;
typedef struct git_iterator git_note_iterator;
/**
* Creates a new iterator for notes
......@@ -47,11 +47,18 @@ typedef struct git_iterator git_iterator;
* @return 0 or an error code
*/
GIT_EXTERN(int) git_note_iterator_new(
git_iterator **out,
git_note_iterator **out,
git_repository *repo,
const char *notes_ref);
/**
* Frees an git_note_iterator
*
* @param it pointer to the iterator
*/
GIT_EXTERN(void) git_note_iterator_free(git_note_iterator *it);
/**
* Next iteration step for note iteration
*
* The notes must not be freed manually by the user.
......@@ -65,7 +72,7 @@ GIT_EXTERN(int) git_note_iterator_new(
GIT_EXTERN(int) git_note_next(
git_oid* note_id,
git_oid* annotated_id,
git_iterator *it);
git_note_iterator *it);
/**
......
......@@ -584,7 +584,7 @@ int git_note_foreach(
void *payload)
{
int error;
git_iterator *iter = NULL;
git_note_iterator *iter = NULL;
git_tree *tree = NULL;
git_commit *commit = NULL;
git_oid annotated_object_id;
......@@ -612,8 +612,17 @@ int git_note_foreach(
return error;
}
void git_note_iterator_free(git_note_iterator *it)
{
if (it == NULL)
return;
git_iterator_free(it);
}
int git_note_iterator_new(
git_iterator **it,
git_note_iterator **it,
git_repository *repo,
const char *notes_ref
)
......@@ -624,7 +633,7 @@ int git_note_iterator_new(
error = retrieve_note_tree_and_commit(&tree, &commit, repo, &notes_ref);
if (!error) {
*it = (git_iterator *)git__malloc(sizeof(git_iterator));
*it = (git_note_iterator *)git__malloc(sizeof(git_iterator));
GITERR_CHECK_ALLOC(*it);
error = git_iterator_for_tree(it, tree);
......@@ -641,7 +650,7 @@ int git_note_iterator_new(
int git_note_next(
git_oid* note_id,
git_oid* annotated_id,
git_iterator *it
git_note_iterator *it
)
{
int error;
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -322,7 +322,7 @@ void test_notes_notes__removing_a_note_which_doesnt_exists_returns_ENOTFOUND(voi
void test_notes_notes__can_iterate_default_namespace(void)
{
git_iterator *iter;
git_note_iterator *iter;
git_note *note;
git_oid note_id, annotated_id;
git_oid note_created[2];
......@@ -346,11 +346,12 @@ void test_notes_notes__can_iterate_default_namespace(void)
}
cl_assert(i == 2);
git_note_iterator_free(iter);
}
void test_notes_notes__can_iterate_custom_namespace(void)
{
git_iterator *iter;
git_note_iterator *iter;
git_note *note;
git_oid note_id, annotated_id;
git_oid note_created[2];
......@@ -374,11 +375,12 @@ void test_notes_notes__can_iterate_custom_namespace(void)
}
cl_assert(i == 2);
git_note_iterator_free(iter);
}
void test_notes_notes__empty_iterate(void)
{
git_iterator *iter;
git_note_iterator *iter;
cl_git_fail(git_note_iterator_new(&iter, _repo, "refs/notes/commits"));
}
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