public void testCheckingOutWithConflicts()
{
var index = new GitIndex(db);
index.add(trash, writeTrashFile("bar", "bar"));
index.add(trash, writeTrashFile("foo/bar/baz/qux", "foo/bar"));
recursiveDelete(new FileInfo(Path.Combine(trash.FullName, "bar")));
recursiveDelete(new DirectoryInfo(Path.Combine(trash.FullName, "foo")));
writeTrashFile("bar/baz/qux/foo", "another nasty one");
writeTrashFile("foo", "troublesome little bugger");
var workDirCheckout1 = new WorkDirCheckout(db, trash, index, index);
AssertHelper.Throws<CheckoutConflictException>(workDirCheckout1.checkout);
var workDirCheckout2 = new WorkDirCheckout(db, trash, index, index) { FailOnConflict = false };
workDirCheckout2.checkout();
Assert.IsTrue(new FileInfo(Path.Combine(trash.FullName, "bar")).IsFile());
Assert.IsTrue(new FileInfo(Path.Combine(trash.FullName, "foo/bar/baz/qux")).IsFile());
var index2 = new GitIndex(db);
recursiveDelete(new FileInfo(Path.Combine(trash.FullName, "bar")));
recursiveDelete(new DirectoryInfo(Path.Combine(trash.FullName, "foo")));
index2.add(trash, writeTrashFile("bar/baz/qux/foo", "bar"));
writeTrashFile("bar/baz/qux/bar", "evil? I thought it said WEEVIL!");
index2.add(trash, writeTrashFile("foo", "lalala"));
workDirCheckout2 = new WorkDirCheckout(db, trash, index2, index) { FailOnConflict = false };
workDirCheckout2.checkout();
Assert.IsTrue(new FileInfo(Path.Combine(trash.FullName, "bar")).IsFile());
Assert.IsTrue(new FileInfo(Path.Combine(trash.FullName, "foo/bar/baz/qux")).IsFile());
Assert.IsNotNull(index2.GetEntry("bar"));
Assert.IsNotNull(index2.GetEntry("foo/bar/baz/qux"));
Assert.IsNull(index2.GetEntry("bar/baz/qux/foo"));
Assert.IsNull(index2.GetEntry("foo"));
}