summaryrefslogtreecommitdiff
path: root/include/git2/notes.h
diff options
context:
space:
mode:
authorBen Straub <bstraub@github.com>2012-06-05 12:52:44 -0700
committerBen Straub <bstraub@github.com>2012-06-05 12:52:44 -0700
commit56a5000d580ef5c9605bc9076610b5af9aa67518 (patch)
tree4026c8333991fbe221a17b5d16e5e4b52f66cb20 /include/git2/notes.h
parente267c9fc1a4910d1081e97b4d7a411658ddc0def (diff)
parent01dbe273c9b6f86a613b67cee27212cf4bacf4c0 (diff)
downloadlibgit2-56a5000d580ef5c9605bc9076610b5af9aa67518.tar.gz
Merge branch 'development' into rev-parse
Conflicts: src/util.h tests-clar/refs/branches/listall.c
Diffstat (limited to 'include/git2/notes.h')
-rw-r--r--include/git2/notes.h40
1 files changed, 36 insertions, 4 deletions
diff --git a/include/git2/notes.h b/include/git2/notes.h
index ecb37f3ab..19073abd1 100644
--- a/include/git2/notes.h
+++ b/include/git2/notes.h
@@ -28,7 +28,7 @@ GIT_BEGIN_DECL
* @param notes_ref OID reference to use (optional); defaults to "refs/notes/commits"
* @param oid OID of the object
*
- * @return GIT_SUCCESS or an error code
+ * @return 0 or an error code
*/
GIT_EXTERN(int) git_note_read(git_note **note, git_repository *repo,
const char *notes_ref, const git_oid *oid);
@@ -62,7 +62,7 @@ GIT_EXTERN(const git_oid *) git_note_oid(git_note *note);
* @param oid The OID of the object
* @param oid The note to add for object oid
*
- * @return GIT_SUCCESS or an error code
+ * @return 0 or an error code
*/
GIT_EXTERN(int) git_note_create(git_oid *out, git_repository *repo,
git_signature *author, git_signature *committer,
@@ -79,7 +79,7 @@ GIT_EXTERN(int) git_note_create(git_oid *out, git_repository *repo,
* @param committer signature of the notes commit committer
* @param oid the oid which note's to be removed
*
- * @return GIT_SUCCESS or an error code
+ * @return 0 or an error code
*/
GIT_EXTERN(int) git_note_remove(git_repository *repo, const char *notes_ref,
git_signature *author, git_signature *committer,
@@ -98,10 +98,42 @@ GIT_EXTERN(void) git_note_free(git_note *note);
* @param out Pointer to the default notes reference
* @param repo The Git repository
*
- * @return GIT_SUCCESS or an error code
+ * @return 0 or an error code
*/
GIT_EXTERN(int) git_note_default_ref(const char **out, git_repository *repo);
+/**
+ * Basic components of a note
+ *
+ * - Oid of the blob containing the message
+ * - Oid of the git object being annotated
+ */
+typedef struct {
+ git_oid blob_oid;
+ git_oid annotated_object_oid;
+} git_note_data;
+
+/**
+ * Loop over all the notes within a specified namespace
+ * and issue a callback for each one.
+ *
+ * @param repo Repository where to find the notes.
+ *
+ * @param notes_ref OID reference to read from (optional); defaults to "refs/notes/commits".
+ *
+ * @param note_cb Callback to invoke per found annotation.
+ *
+ * @param payload Extra parameter to callback function.
+ *
+ * @return 0 or an error code.
+ */
+GIT_EXTERN(int) git_note_foreach(
+ git_repository *repo,
+ const char *notes_ref,
+ int (*note_cb)(git_note_data *note_data, void *payload),
+ void *payload
+);
+
/** @} */
GIT_END_DECL
#endif