[libgit2-glib] Provide ggit_repository_read_note
- From: Ignacio Casal Quinteiro <icq src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgit2-glib] Provide ggit_repository_read_note
- Date: Sat, 18 Oct 2014 13:23:54 +0000 (UTC)
commit 560add3c8fe3328d3d6ae3f4f883f686d8f0f914
Author: Ignacio Casal Quinteiro <icq gnome org>
Date: Sat Oct 18 15:23:24 2014 +0200
Provide ggit_repository_read_note
libgit2-glib/ggit-repository.c | 38 ++++++++++++++++++++++++++++++++++++++
libgit2-glib/ggit-repository.h | 6 ++++++
2 files changed, 44 insertions(+), 0 deletions(-)
---
diff --git a/libgit2-glib/ggit-repository.c b/libgit2-glib/ggit-repository.c
index 72eb2fb..113711e 100644
--- a/libgit2-glib/ggit-repository.c
+++ b/libgit2-glib/ggit-repository.c
@@ -3119,4 +3119,42 @@ ggit_repository_remove_note (GgitRepository *repository,
return TRUE;
}
+/**
+ * ggit_repository_read_note:
+ * @repository: a #GgitRepository.
+ * @notes_ref: (allow-none): canonical name of the reference to use, or %NULL to use the default ref.
+ * @id: OID of the git object to decorate.
+ * @error: a #GError for error reporting, or %NULL.
+ *
+ * Reads the note for an object.
+ *
+ * Returns: (transfer full): the read note or %NULL in case of an error.
+ */
+GgitNote *
+ggit_repository_read_note (GgitRepository *repository,
+ const gchar *notes_ref,
+ GgitOId *id,
+ GError **error)
+{
+ gint ret;
+ git_note *note;
+
+ g_return_val_if_fail (GGIT_IS_REPOSITORY (repository), FALSE);
+ g_return_val_if_fail (id != NULL, FALSE);
+ g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+
+ ret = git_note_read (¬e,
+ _ggit_native_get (repository),
+ notes_ref,
+ _ggit_oid_get_oid (id));
+
+ if (ret != GIT_OK)
+ {
+ _ggit_error_set (error, ret);
+ return FALSE;
+ }
+
+ return _ggit_note_wrap (note);
+}
+
/* ex:set ts=8 noet: */
diff --git a/libgit2-glib/ggit-repository.h b/libgit2-glib/ggit-repository.h
index a0ca2b8..20cdf84 100644
--- a/libgit2-glib/ggit-repository.h
+++ b/libgit2-glib/ggit-repository.h
@@ -34,6 +34,7 @@
#include <libgit2-glib/ggit-branch.h>
#include <libgit2-glib/ggit-blob-output-stream.h>
#include <libgit2-glib/ggit-checkout-options.h>
+#include <libgit2-glib/ggit-note.h>
G_BEGIN_DECLS
@@ -406,6 +407,11 @@ gboolean ggit_repository_remove_note (GgitRepository
GgitOId *id,
GError **error);
+GgitNote *ggit_repository_read_note (GgitRepository *repository,
+ const gchar *notes_ref,
+ GgitOId *id,
+ GError **error);
+
G_END_DECLS
#endif /* __GGIT_REPOSITORY_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]