コード例 #1
0
        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);
        }
コード例 #2
0
        public string GetRootFolder()
        {
            var output = Utils.ProcessExeAndGetOutput(gitExe, "rev-parse --show-toplevel");

            if (!ExeOutput.IsSuccess(output))
            {
                return(null);
            }

            return(ExeOutput.AsString(output).Trim());
        }
コード例 #3
0
 public bool Exists()
 {
     return(ExeOutput.IsSuccess(Utils.ProcessExeAndGetOutput(gitExe, "status")));
 }