public static string[] AddedOrModifiedFiles() { var headToc = Refs.Hash("HEAD") != null?Objects.CommitToc(Refs.Hash("HEAD")) : new Dictionary <string, string>(); var wc = Diff.NameStatus(Diff.TocDiff(headToc, Index.WorkingCopyToc())); return(wc.Where(item => item.Value != FileStatus.DELETE).Select(item => item.Key).ToArray()); }
private static string[] ToBeCommitted() { var headHash = Refs.Hash("HEAD"); var headToc = headHash == null ? new Dictionary <string, string>() : Objects.CommitToc(headHash); var ns = Diff.NameStatus(Diff.TocDiff(headToc, Index.Toc())); return(ns.Select(item => item.Value.Value + " " + item.Key).ToArray()); }
/// <summary> /// Gets a list of files /// changed in the working copy. It gets a list of the files that /// are different in the head commit and the commit for the passed /// hash. It returns a list of paths that appear in both lists. /// </summary> public static string[] ChangedFilesCommitWouldOverwrite(string hash) { var headHash = Refs.Hash("HEAD"); return (Diff.NameStatus(Diff.GetDiff(headHash)).Keys .Intersect(Diff.NameStatus(Diff.GetDiff(headHash, hash)).Keys) .ToArray()); }
public static string[] CommitParentHashes() { var headHash = Refs.Hash("HEAD"); // If the repository is in the middle of a merge, return the // hashes of the two commits being merged. if (Merge.IsMergeInProgress()) { return(new[] { headHash, Refs.Hash("MERGE_HEAD") }); } // If this repository has no commits, return an empty array. if (headHash == null) { return(new string[0]); } // Otherwise, return the hash of the commit that `HEAD` is // currently pointing at. return(new[] { headHash }); }
/// <summary> /// returns true if the repository is in the middle of a merge. /// </summary> /// <returns></returns> public static bool IsMergeInProgress() { return(Refs.Hash("MERGE_HEAD") != null); }