/// <summary> /// Parser of porcelain line for modified files (line type "1") /// </summary> /// <param name="lineWithoutType">Single line from git status --porcelain=v2 without the leading char (line/parser type)</param> /// <param name="gitInfo">(Not used) Reference to the root git info object in case the parser needs to manipulate root data</param> /// <returns>New instance of file item info if created by line parser otherwise null (when the <paramref name="lineWithoutType"/> is empty)</returns> private static GitPorcelainFileItemInfo GitPorcelainItemType1Parser(string lineWithoutType, GitPorcelainInfo gitInfo) { if (string.IsNullOrEmpty(lineWithoutType)) { return(null); } var item = new GitPorcelainFileItemInfo(); var line = lineWithoutType; var xy = line.SplitByFirstSpace(out line) + " "; //ensure at least two chars var fileName = line.LastPart(" ").Trim(); if (string.IsNullOrEmpty(fileName)) { return(null); } item.ChangeCode = xy.Trim(); item.StatusIndex = GetGitChangeType(xy[0]); item.StatusWorkTree = GetGitChangeType(xy[1]); item.IsUnMerged = xy.Contains("U") || xy == "AA" || xy == "DD"; item.IsNotTracked = xy.Contains("?"); item.IsIgnored = xy.Contains("!"); item.FileName = fileName; return(item); }
/// <summary> /// Parser of porcelain line for ignored files (line type "!") /// </summary> /// <param name="lineWithoutType">Single line from git status --porcelain=v2 without the leading char (line/parser type)</param> /// <param name="gitInfo">(Not used) Reference to the root git info object in case the parser needs to manipulate root data</param> /// <returns>New instance of file item info if created by line parser otherwise null (when the <paramref name="lineWithoutType"/> is empty)</returns> private static GitPorcelainFileItemInfo GitPorcelainItemIgnoredParser(string lineWithoutType, GitPorcelainInfo gitInfo) { if (string.IsNullOrEmpty(lineWithoutType)) { return(null); } var item = new GitPorcelainFileItemInfo { FileName = lineWithoutType, ChangeCode = "!", StatusIndex = GitChangeTypeEnum.Ignored, StatusWorkTree = GitChangeTypeEnum.Ignored, IsIgnored = true }; return(item); }