string[] cmd = { "pull" , "--no-edit" };
return this.git( cmd );
- //var e = yield dir.enumerate_children_async(
- // FileAttribute.STANDARD_NAME, 0, Priority.DEFAULT, null);
-
}
+ public delegate void GitAsyncCallback (GitRepo repo, string str);
+ public void pull_async(GitAsyncCallback cb)
+ {
- async public void pull_async(Callback_pull cb) {
-
+ string[] cmd = { "pull" , "--no-edit" };
+ this.git_async( cmd , cb);
+
}
// parse output for some commands ?
return sp.output;
}
+
+ unowned GitAsyncCallback git_async_on_callback;
+ public void git_async( string[] args_in, GitAsyncCallback cb ) throws Error, SpawnError
+ {
+ // convert arguments.
+ this.git_async_on_callback = cb;
+ string[] args = { "git" };
+ //args += "--git-dir";
+ //args += this.gitdir;
+ args += "--no-pager";
+
+
+ //if (this.gitdir != this.repopath) {
+ // args += "--work-tree";
+ // args += this.repopath;
+ //}
+ for (var i = 0; i < args_in.length;i++) {
+ args += args_in[i];
+ }
+ //this.lastCmd = args.join(" ");
+ //if(this.debug) {
+ stdout.printf( "CWD=%s\n", this.git_working_dir );
+ print( "cmd: %s\n", string.joinv (" ", args));
+ //}
+
+ string[] env = {};
+ string home = "HOME=" + Environment.get_home_dir() ;
+ env += home ;
+ // do not need to set gitpath..
+ //if (File.exists(this.repo + '/.git/config')) {
+ //env.push("GITPATH=" + this.repo );
+ //}
+
+
+ var cfg = new SpawnConfig(this.git_working_dir , args , env);
+ cfg.async = true;
+
+
+ // may throw error...
+ var sp = new Spawn(cfg);
+ //sp.ref();
+ //this.ref();
+ sp.run(this.git_async_on_complete);
+
+ }
+
+ void git_async_on_complete(int err, string output)
+ {
+ print("GOT %s\n", output);
+ this.git_async_on_callback(this, output);
+// this.unref();
+ // sp.unref();
+
+
+ }
+
}