[libgit2-glib] Update walk example for new API



commit 3b282fb4743ecf0f8a0b9f0a424e217404ea733c
Author: Jesse van den Kieboom <jessevdk gmail com>
Date:   Sat Nov 23 01:16:47 2013 +0100

    Update walk example for new API

 examples/walk.c |   20 +++++++++-----------
 1 files changed, 9 insertions(+), 11 deletions(-)
---
diff --git a/examples/walk.c b/examples/walk.c
index 8610cab..223d4dc 100644
--- a/examples/walk.c
+++ b/examples/walk.c
@@ -47,13 +47,11 @@ signature_to_string (GgitSignature *signature)
 
 static int
 diff_print_cb (GgitDiffDelta    *delta,
-               GgitDiffRange    *range,
-               GgitDiffLineType  line_type,
-               const gchar      *content,
-               gsize             content_len,
+               GgitDiffHunk     *hunk,
+               GgitDiffLine     *line,
                gpointer          user_data)
 {
-       g_print ("%s", content);
+       g_print ("%s", ggit_diff_line_get_content (line));
        return 0;
 }
 
@@ -163,19 +161,19 @@ main (int   argc,
                        GgitCommit *parent_commit;
                        GgitTree *commit_tree;
                        GgitTree *parent_tree;
-                       GgitDiffList *diff;
+                       GgitDiff *diff;
 
                        parent_commit = ggit_commit_parents_get (commit_parents, 0);
                        commit_tree = ggit_commit_get_tree (commit);
                        parent_tree = ggit_commit_get_tree (parent_commit);
 
-                       diff = ggit_diff_list_new_tree_to_tree (repo,
-                                                               parent_tree,
-                                                               commit_tree,
-                                                               NULL, &err);
+                       diff = ggit_diff_new_tree_to_tree (repo,
+                                                          parent_tree,
+                                                          commit_tree,
+                                                          NULL, &err);
                        g_assert_no_error (err);
 
-                       ggit_diff_list_print_patch (diff, diff_print_cb, NULL, &err);
+                       ggit_diff_print (diff, GGIT_DIFF_FORMAT_PATCH, diff_print_cb, NULL, &err);
                        g_assert_no_error (err);
 
                        g_object_unref (diff);


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