diff options
author | Ben Straub <bs@github.com> | 2012-11-27 18:59:22 -0800 |
---|---|---|
committer | Ben Straub <bs@github.com> | 2012-11-27 18:59:22 -0800 |
commit | 64c5112188647fcbfbe2bbfb897abfbc21912ba8 (patch) | |
tree | 5113408a049178d14664f72cc1666655783d95d5 /include/git2/notes.h | |
parent | 469827812f95e979e3c6468567b2c9ed138a9849 (diff) | |
parent | ca94e031fa21787ae6336f0aada1b01b2dd22077 (diff) | |
download | libgit2-64c5112188647fcbfbe2bbfb897abfbc21912ba8.tar.gz |
Merge pull request #1087 from libgit2/great-renaming
The Great Renaming of 2012
Diffstat (limited to 'include/git2/notes.h')
-rw-r--r-- | include/git2/notes.h | 65 |
1 files changed, 37 insertions, 28 deletions
diff --git a/include/git2/notes.h b/include/git2/notes.h index af480a408..ae66975cd 100644 --- a/include/git2/notes.h +++ b/include/git2/notes.h @@ -19,20 +19,34 @@ GIT_BEGIN_DECL /** + * Callback for git_note_foreach. + * + * Receives: + * - blob_id: Oid of the blob containing the message + * - annotated_object_id: Oid of the git object being annotated + * - payload: Payload data passed to `git_note_foreach` + */ +typedef int (*git_note_foreach_cb)( + const git_oid *blob_id, const git_oid *annotated_object_id, void *payload); + +/** * Read the note for an object * * The note must be freed manually by the user. * - * @param note pointer to the read note; NULL in case of error + * @param out pointer to the read note; NULL in case of error * @param repo repository where to look up the note - * @param notes_ref canonical name of the reference to use (optional); - * defaults to "refs/notes/commits" + * @param notes_ref canonical name of the reference to use (optional); defaults to + * "refs/notes/commits" * @param oid OID of the git object to read the note from * * @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); +GIT_EXTERN(int) git_note_read( + git_note **out, + git_repository *repo, + const char *notes_ref, + const git_oid *oid); /** * Get the note message @@ -40,7 +54,7 @@ GIT_EXTERN(int) git_note_read(git_note **note, git_repository *repo, * @param note * @return the note message */ -GIT_EXTERN(const char *) git_note_message(git_note *note); +GIT_EXTERN(const char *) git_note_message(const git_note *note); /** @@ -49,7 +63,7 @@ GIT_EXTERN(const char *) git_note_message(git_note *note); * @param note * @return the note object OID */ -GIT_EXTERN(const git_oid *) git_note_oid(git_note *note); +GIT_EXTERN(const git_oid *) git_note_oid(const git_note *note); /** * Add a note for an object @@ -65,10 +79,14 @@ GIT_EXTERN(const git_oid *) git_note_oid(git_note *note); * * @return 0 or an error code */ -GIT_EXTERN(int) git_note_create(git_oid *out, git_repository *repo, - git_signature *author, git_signature *committer, - const char *notes_ref, const git_oid *oid, - const char *note); +GIT_EXTERN(int) git_note_create( + git_oid *out, + git_repository *repo, + const git_signature *author, + const git_signature *committer, + const char *notes_ref, + const git_oid *oid, + const char *note); /** @@ -83,9 +101,12 @@ GIT_EXTERN(int) git_note_create(git_oid *out, git_repository *repo, * * @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, - const git_oid *oid); +GIT_EXTERN(int) git_note_remove( + git_repository *repo, + const char *notes_ref, + const git_signature *author, + const git_signature *committer, + const git_oid *oid); /** * Free a git_note object @@ -105,17 +126,6 @@ GIT_EXTERN(void) git_note_free(git_note *note); 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. * @@ -134,9 +144,8 @@ typedef struct { 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_note_foreach_cb note_cb, + void *payload); /** @} */ GIT_END_DECL |