Ejemplo n.º 1
0
int git_note_foreach(
	git_repository *repo,
	const char *notes_ref,
	git_note_foreach_cb note_cb,
	void *payload)
{
	int error;
	git_iterator *iter = NULL;
	git_tree *tree = NULL;
	git_commit *commit = NULL;
	const git_index_entry *item;

	if (!(error = retrieve_note_tree_and_commit(
			&tree, &commit, repo, &notes_ref)) &&
		!(error = git_iterator_for_tree(&iter, tree)))
		error = git_iterator_current(iter, &item);

	while (!error && item) {
		error = process_entry_path(item->path, &item->oid, note_cb, payload);

		if (!error)
			error = git_iterator_advance(iter, &item);
	}

	git_iterator_free(iter);
	git_tree_free(tree);
	git_commit_free(commit);

	return error;
}
Ejemplo n.º 2
0
Archivo: notes.c Proyecto: 0CV0/libgit2
int git_note_next(
	git_oid* note_id,
	git_oid* annotated_id,
	git_note_iterator *it)
{
	int error;
	const git_index_entry *item;

	if ((error = git_iterator_current(&item, it)) < 0)
		return error;

	git_oid_cpy(note_id, &item->oid);

	if (!(error = process_entry_path(item->path, annotated_id)))
		git_iterator_advance(NULL, it);

	return error;
}