[gitg/wip/commit: 25/28] Add diff_index and diff_workdir convenience methods on stage



commit d5095154a08bba0c5ccacd171ede438686d2424e
Author: Jesse van den Kieboom <jessevdk gmail com>
Date:   Wed Jul 3 16:42:11 2013 +0200

    Add diff_index and diff_workdir convenience methods on stage

 libgitg/gitg-stage.vala |   31 +++++++++++++++++++++++++++++++
 1 files changed, 31 insertions(+), 0 deletions(-)
---
diff --git a/libgitg/gitg-stage.vala b/libgitg/gitg-stage.vala
index 0fc0267..8ea5b81 100644
--- a/libgitg/gitg-stage.vala
+++ b/libgitg/gitg-stage.vala
@@ -160,6 +160,37 @@ public class Stage : Object
                });
        }
 
+       public async Ggit.DiffList? diff_index(StageStatusFile f) throws Error
+       {
+               var opts = new Ggit.DiffOptions(Ggit.DiffOption.NORMAL,
+                                               3,
+                                               3,
+                                               null,
+                                               null,
+                                               new string[] {f.path});
+
+               var tree = yield get_head_tree();
+
+               return new Ggit.DiffList.tree_to_index(d_repository,
+                                                      tree,
+                                                      d_repository.get_index(),
+                                                      opts);
+       }
+
+       public async Ggit.DiffList? diff_workdir(StageStatusFile f) throws Error
+       {
+               var opts = new Ggit.DiffOptions(Ggit.DiffOption.NORMAL,
+                                               3,
+                                               3,
+                                               null,
+                                               null,
+                                               new string[] {f.path});
+
+               return new Ggit.DiffList.index_to_workdir(d_repository,
+                                                         d_repository.get_index(),
+                                                         opts);
+       }
+
        /**
         * Unstage a file from the index.
         *


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