public List <FileStatus> GetUncommitedFiles() { var list = new List <FileStatus>(); var cmds = new List <string>(); var rootFolder = GetRootFolder(); cmds.Add("status -s"); foreach (var c in cmds) { var output = Utils.ProcessExeAndGetOutput(gitExe, c); if (rootFolder == null || !ExeOutput.IsSuccess(output)) { return(list); } foreach (var o in output) { var lines = o.Line.Trim().Split(' ').Where(f => f.Trim() != ""); var s = new FileStatus { Type = lines.ElementAtOrDefault(0), RelativePath = lines.ElementAtOrDefault(1), }; s.FullPath = Path.GetFullPath(s.RelativePath); list.Add(s); } } return(list); }
public string GetRootFolder() { var output = Utils.ProcessExeAndGetOutput(gitExe, "rev-parse --show-toplevel"); if (!ExeOutput.IsSuccess(output)) { return(null); } return(ExeOutput.AsString(output).Trim()); }
public bool Exists() { return(ExeOutput.IsSuccess(Utils.ProcessExeAndGetOutput(gitExe, "status"))); }