[libgit2-glib] Added ggit_patch_get_delta



commit f2f410a63d3507113eace3ad61a2a9a481790f94
Author: Jesse van den Kieboom <jessevdk gmail com>
Date:   Sat Nov 23 15:07:31 2013 +0100

    Added ggit_patch_get_delta

 libgit2-glib/ggit-patch.c |   17 +++++++++++++++++
 libgit2-glib/ggit-patch.h |    2 ++
 2 files changed, 19 insertions(+), 0 deletions(-)
---
diff --git a/libgit2-glib/ggit-patch.c b/libgit2-glib/ggit-patch.c
index 7c38233..e89313b 100644
--- a/libgit2-glib/ggit-patch.c
+++ b/libgit2-glib/ggit-patch.c
@@ -20,6 +20,7 @@
 
 #include "ggit-patch.h"
 #include "ggit-diff.h"
+#include "ggit-diff-delta.h"
 #include "ggit-error.h"
 #include "ggit-diff-options.h"
 
@@ -362,4 +363,20 @@ ggit_patch_get_num_lines_in_hunk (GgitPatch *patch,
        return git_patch_num_lines_in_hunk (patch->patch, hunk);
 }
 
+/**
+ * ggit_patch_get_delta:
+ * @patch: a #GgitPatch.
+ *
+ * Get the diff delta corresponding to the patch.
+ *
+ * Returns: (transfer full): the #GgitDiffDelta of the patch.
+ */
+GgitDiffDelta *
+ggit_patch_get_delta (GgitPatch *patch)
+{
+       g_return_val_if_fail (patch != NULL, NULL);
+
+       return _ggit_diff_delta_wrap (git_patch_get_delta (patch->patch));
+}
+
 /* ex:set ts=8 noet: */
diff --git a/libgit2-glib/ggit-patch.h b/libgit2-glib/ggit-patch.h
index bf6547f..7e5d7c1 100644
--- a/libgit2-glib/ggit-patch.h
+++ b/libgit2-glib/ggit-patch.h
@@ -69,6 +69,8 @@ gint             ggit_patch_get_num_lines_in_hunk (
                                              GgitPatch      *patch,
                                              gsize           hunk);
 
+GgitDiffDelta   *ggit_patch_get_delta        (GgitPatch     *patch);
+
 G_END_DECLS
 
 #endif /* __GGIT_PATCH_H__ */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]