]> source.dussan.org Git - jgit.git/commitdiff
Add one more test to ReadTreeTest 50/1450/1
authorChristian Halstrick <christian.halstrick@sap.com>
Mon, 30 Aug 2010 07:07:59 +0000 (09:07 +0200)
committerChristian Halstrick <christian.halstrick@sap.com>
Mon, 30 Aug 2010 07:34:17 +0000 (09:34 +0200)
Add an explicit test case to check that we don't
overwrite dirty files in case Head & Index are
equal.

Change-Id: I6266d0a449e55369d2d0a048694dca5565c5fcf3
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ReadTreeTest.java

index 22430e6858bce393d616e156b50a77ce3fa15e12..cb82389f6ab85d6bf04fa2399f80e3e95dea3ea4 100644 (file)
@@ -657,6 +657,20 @@ public abstract class ReadTreeTest extends RepositoryTestCase {
                assertTrue(new File(trash, "foo").isFile());
        }
 
+       public void testDontOverwriteDirtyFile() throws IOException {
+               setupCase(mk("foo"), mk("other"), mk("foo"));
+               writeTrashFile("foo", "different");
+               try {
+                       checkout();
+                       fail("Didn't got the expected conflict");
+               } catch (CheckoutConflictException e) {
+                       assertIndex(mk("foo"));
+                       assertWorkDir(mkmap("foo", "different"));
+                       assertTrue(getConflicts().equals(Arrays.asList("foo")));
+                       assertTrue(new File(trash, "foo").isFile());
+               }
+       }
+
        /**
         * The interface these tests need from a class implementing a checkout
         */