[libgit2-glib] Add ggit_diff_get_delta
- From: Jesse van den Kieboom <jessevdk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgit2-glib] Add ggit_diff_get_delta
- Date: Mon, 15 Aug 2016 13:18:03 +0000 (UTC)
commit f4cfcd63c0c907297399f3d8ed699dd879ec8260
Author: Jesse van den Kieboom <jessevdk gnome org>
Date: Mon Aug 15 12:30:02 2016 +0200
Add ggit_diff_get_delta
libgit2-glib/ggit-diff.c | 23 +++++++++++++++++++++++
libgit2-glib/ggit-diff.h | 3 +++
2 files changed, 26 insertions(+), 0 deletions(-)
---
diff --git a/libgit2-glib/ggit-diff.c b/libgit2-glib/ggit-diff.c
index e36f3d4..7adb055 100644
--- a/libgit2-glib/ggit-diff.c
+++ b/libgit2-glib/ggit-diff.c
@@ -709,6 +709,29 @@ ggit_diff_get_num_deltas (GgitDiff *diff)
}
/**
+ * ggit_diff_get_delta:
+ * @diff: a #GgitDiff.
+ * @index: the index.
+ *
+ * Get the delta at the specified index.
+ *
+ * Returns: (transfer full): a #GgitDiffDelta.
+ *
+ **/
+GgitDiffDelta *
+ggit_diff_get_delta (GgitDiff *diff,
+ gint index)
+{
+ const git_diff_delta *delta;
+
+ g_return_val_if_fail (GGIT_IS_DIFF (diff), NULL);
+
+ delta = git_diff_get_delta (_ggit_native_get (diff), (size_t)index);
+
+ return _ggit_diff_delta_wrap (delta);
+}
+
+/**
* ggit_diff_blobs:
* @old_blob: (allow-none): a #GgitBlob to diff from.
* @old_as_path: (allow-none): treat @old_blob as if it had this filename, or %NULL,
diff --git a/libgit2-glib/ggit-diff.h b/libgit2-glib/ggit-diff.h
index e2025c9..d6edeb3 100644
--- a/libgit2-glib/ggit-diff.h
+++ b/libgit2-glib/ggit-diff.h
@@ -90,6 +90,9 @@ gchar *ggit_diff_format_email (GgitDiff *diff,
gint ggit_diff_get_num_deltas (GgitDiff *diff);
+GgitDiffDelta *ggit_diff_get_delta (GgitDiff *diff,
+ gint index);
+
void ggit_diff_blobs (GgitBlob *old_blob,
const gchar *old_as_path,
GgitBlob *new_blob,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]