diff options
author | yorah <yoram.harmelin@gmail.com> | 2013-04-18 19:34:32 +0400 |
---|---|---|
committer | nulltoken <emeric.fermas@gmail.com> | 2013-04-24 21:50:24 +0400 |
commit | 068d4958813afb78f2782f9892444783ffd8a779 (patch) | |
tree | 97381401e22acd8d7f687250d0287718454ca40f /LibGit2Sharp/TreeChanges.cs | |
parent | 6a02dd8b7761828b25a8b1420199a0040034c1a2 (diff) |
Make Index.Remove() diff-based
Note: it means that the paths passed to Remove() are pathspecs, and thus behavior has been aligned with Stage()/Unstage() => calling Remove() by passing a pathspec which doesn't match any paths doesn't throw anymore (breaking change).
Diffstat (limited to 'LibGit2Sharp/TreeChanges.cs')
-rw-r--r-- | LibGit2Sharp/TreeChanges.cs | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/LibGit2Sharp/TreeChanges.cs b/LibGit2Sharp/TreeChanges.cs index 0571d20e..c1079803 100644 --- a/LibGit2Sharp/TreeChanges.cs +++ b/LibGit2Sharp/TreeChanges.cs @@ -22,6 +22,7 @@ namespace LibGit2Sharp private readonly List<TreeEntryChanges> deleted = new List<TreeEntryChanges>(); private readonly List<TreeEntryChanges> modified = new List<TreeEntryChanges>(); private readonly List<TreeEntryChanges> typeChanged = new List<TreeEntryChanges>(); + private readonly List<TreeEntryChanges> unmodified = new List<TreeEntryChanges>(); private int linesAdded; private int linesDeleted; @@ -37,6 +38,7 @@ namespace LibGit2Sharp { ChangeKind.Deleted, (de, d) => de.deleted.Add(d) }, { ChangeKind.Added, (de, d) => de.added.Add(d) }, { ChangeKind.TypeChanged, (de, d) => de.typeChanged.Add(d) }, + { ChangeKind.Unmodified, (de, d) => de.unmodified.Add(d) }, }; } @@ -56,7 +58,7 @@ namespace LibGit2Sharp string formattedoutput = Utf8Marshaler.FromNative(content, (int)contentlen); TreeEntryChanges currentChange = AddFileChange(delta, lineorigin); - if (currentChange == null) + if (delta.Status == ChangeKind.Unmodified) { return 0; } @@ -87,11 +89,6 @@ namespace LibGit2Sharp private TreeEntryChanges AddFileChange(GitDiffDelta delta, GitDiffLineOrigin lineorigin) { - if (delta.Status == ChangeKind.Unmodified) - { - return null; - } - var newFilePath = FilePathMarshaler.FromNative(delta.NewFile.Path); if (lineorigin != GitDiffLineOrigin.GIT_DIFF_LINE_FILE_HDR) |