aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.jgit.test')
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/DirCacheCheckoutTest.java19
1 files changed, 19 insertions, 0 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/DirCacheCheckoutTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/DirCacheCheckoutTest.java
index afbad6ab2c..f7e6fa9b79 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/DirCacheCheckoutTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/DirCacheCheckoutTest.java
@@ -72,6 +72,8 @@ import org.eclipse.jgit.errors.CheckoutConflictException;
import org.eclipse.jgit.errors.CorruptObjectException;
import org.eclipse.jgit.errors.NoWorkTreeException;
import org.eclipse.jgit.junit.RepositoryTestCase;
+import org.eclipse.jgit.junit.TestRepository;
+import org.eclipse.jgit.junit.TestRepository.BranchBuilder;
import org.eclipse.jgit.revwalk.RevCommit;
import org.eclipse.jgit.treewalk.FileTreeIterator;
import org.eclipse.jgit.treewalk.TreeWalk;
@@ -213,6 +215,23 @@ public class DirCacheCheckoutTest extends RepositoryTestCase {
assertIndex(mkmap("x", "x"));
}
+ /**
+ * Test first checkout in a repo
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testInitialCheckout() throws Exception {
+ Git git = new Git(db);
+
+ TestRepository<Repository> db_t = new TestRepository<Repository>(db);
+ BranchBuilder master = db_t.branch("master");
+ master.commit().add("f", "1").message("m0").create();
+ assertFalse(new File(db.getWorkTree(), "f").exists());
+ git.checkout().setName("master").call();
+ assertTrue(new File(db.getWorkTree(), "f").exists());
+ }
+
private DirCacheCheckout resetHard(RevCommit commit)
throws NoWorkTreeException,
CorruptObjectException, IOException {