From e943bcb992799f9f059322accb0f42fac008ad66 Mon Sep 17 00:00:00 2001 From: Alan Knowles Date: Sat, 23 Sep 2017 13:27:19 +0800 Subject: [PATCH] GitRepo.vala --- GitRepo.vala | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/GitRepo.vala b/GitRepo.vala index 69a8397c..6f9ffb4c 100644 --- a/GitRepo.vala +++ b/GitRepo.vala @@ -349,5 +349,50 @@ public class GitRepo : Object // parse output for some commands ? return sp.output; } + + + public string git_async(string[] args_in ) throws Error, SpawnError + { + // convert arguments. + + 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); + + + // may throw error... + var sp = new Spawn(cfg); + + + stdout.printf( "GOT: %s\n" , sp.output); + // parse output for some commands ? + return sp.output; + } } -- 2.39.2