[gitg/wip/commit] Fix async handling of pre commit hook



commit bfc01cfab7124d31e8e5adf3cdf1b0e32f90b028
Author: Jesse van den Kieboom <jessevdk gmail com>
Date:   Fri Jul 5 15:45:46 2013 +0200

    Fix async handling of pre commit hook

 libgitg/gitg-stage.vala |   23 ++++++++---------------
 1 files changed, 8 insertions(+), 15 deletions(-)
---
diff --git a/libgitg/gitg-stage.vala b/libgitg/gitg-stage.vala
index 0d8cb67..d1ddada 100644
--- a/libgitg/gitg-stage.vala
+++ b/libgitg/gitg-stage.vala
@@ -207,7 +207,6 @@ public class Stage : Object
 
        public async void pre_commit_hook(Ggit.Signature author) throws StageError
        {
-               SourceFunc cb = pre_commit_hook.callback;
                string? errormsg = null;
 
                yield Async.thread(() => {
@@ -216,24 +215,18 @@ public class Stage : Object
 
                        setup_commit_hook_environment(hook, author);
 
-                       hook.run.begin(d_repository, (obj, res) => {
-                               try
-                               {
-                                       int status = hook.run.end(res);
+                       try
+                       {
+                               int status = hook.run_sync(d_repository);
 
-                                       if (status != 0)
-                                       {
-                                               errormsg = string.joinv("\n", hook.output);
-                                       }
+                               if (status != 0)
+                               {
+                                       errormsg = string.joinv("\n", hook.output);
                                }
-                               catch (SpawnError e) {}
-
-                               cb();
-                       });
+                       }
+                       catch (SpawnError e) {}
                });
 
-               yield;
-
                if (errormsg != null)
                {
                        throw new StageError.PRE_COMMIT_HOOK_FAILED(errormsg);


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