Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2sharp.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornulltoken <emeric.fermas@gmail.com>2015-01-10 13:43:45 +0300
committernulltoken <emeric.fermas@gmail.com>2015-01-21 15:38:10 +0300
commita8973a47ba4face0421656ed9a3ee92ce204f4ed (patch)
tree5542397cd8073c9f231c260987be67a7888c4afb /LibGit2Sharp.Tests
parentcf0a893ff150baa7c8eafb5819fad6a42719c664 (diff)
Expose low level Index.Remove()
Diffstat (limited to 'LibGit2Sharp.Tests')
-rw-r--r--LibGit2Sharp.Tests/IndexFixture.cs19
1 files changed, 19 insertions, 0 deletions
diff --git a/LibGit2Sharp.Tests/IndexFixture.cs b/LibGit2Sharp.Tests/IndexFixture.cs
index 94762236..1d504607 100644
--- a/LibGit2Sharp.Tests/IndexFixture.cs
+++ b/LibGit2Sharp.Tests/IndexFixture.cs
@@ -373,5 +373,24 @@ namespace LibGit2Sharp.Tests
Assert.Equal(FileStatus.Removed | FileStatus.Untracked, repo.RetrieveStatus(testFile));
}
}
+
+ [Theory]
+ [InlineData("new_tracked_file.txt", FileStatus.Added, FileStatus.Untracked)]
+ [InlineData("modified_staged_file.txt", FileStatus.Staged, FileStatus.Removed | FileStatus.Untracked)]
+ [InlineData("i_dont_exist.txt", FileStatus.Nonexistent, FileStatus.Nonexistent)]
+ public void CanRemoveAnEntryFromTheIndex(string pathInTheIndex, FileStatus expectedBeforeStatus, FileStatus expectedAfterStatus)
+ {
+ var path = SandboxStandardTestRepoGitDir();
+ using (var repo = new Repository(path))
+ {
+ var before = repo.RetrieveStatus(pathInTheIndex);
+ Assert.Equal(expectedBeforeStatus, before);
+
+ repo.Index.Remove(pathInTheIndex);
+
+ var after = repo.RetrieveStatus(pathInTheIndex);
+ Assert.Equal(expectedAfterStatus, after);
+ }
+ }
}
}