mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-06 06:22:41 +00:00
use git_note_iterator type instead of non-public git_iterator one
This commit is contained in:
parent
6edb427b76
commit
1a90dcf64e
@ -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,10 +47,17 @@ 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
|
||||
*
|
||||
@ -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);
|
||||
|
||||
|
||||
/**
|
||||
|
17
src/notes.c
17
src/notes.c
@ -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, ¬es_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;
|
||||
|
3453
tests-clar/clar_main.c
Normal file
3453
tests-clar/clar_main.c
Normal file
File diff suppressed because it is too large
Load Diff
@ -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"));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user