diff options
author | Stefan Lay <stefan.lay@sap.com> | 2010-07-22 14:27:35 +0200 |
---|---|---|
committer | Stefan Lay <stefan.lay@sap.com> | 2010-07-22 14:27:35 +0200 |
commit | 88957f6c5ad3c6e74a8b6d5fcd82006fae9c60a0 (patch) | |
tree | 4e7d04f587d44fbb4ab157a818f67c05fa07894e /org.eclipse.jgit.test/tst/org/eclipse/jgit/api | |
parent | aa86cfc33960938a62a8d0b300a153749bedfc64 (diff) | |
download | jgit-88957f6c5ad3c6e74a8b6d5fcd82006fae9c60a0.tar.gz jgit-88957f6c5ad3c6e74a8b6d5fcd82006fae9c60a0.zip |
Allow for filepattern "." in AddCommand
Enable adding on repository root level.
Change-Id: I415b10dc74cc9435578424d9f106c972fd703055
Signed-off-by: Stefan Lay <stefan.lay@sap.com>
Diffstat (limited to 'org.eclipse.jgit.test/tst/org/eclipse/jgit/api')
-rw-r--r-- | org.eclipse.jgit.test/tst/org/eclipse/jgit/api/AddCommandTest.java | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/AddCommandTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/AddCommandTest.java index 00e39ebe38..ab011807cb 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/AddCommandTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/AddCommandTest.java @@ -338,6 +338,26 @@ public class AddCommandTest extends RepositoryTestCase { assertEquals(0, dc.getEntry("sub/a.txt").getStage()); } + public void testAddWholeRepo() throws Exception { + new File(db.getWorkDir(), "sub").mkdir(); + File file = new File(db.getWorkDir(), "sub/a.txt"); + file.createNewFile(); + PrintWriter writer = new PrintWriter(file); + writer.print("content"); + writer.close(); + + File file2 = new File(db.getWorkDir(), "sub/b.txt"); + file2.createNewFile(); + writer = new PrintWriter(file2); + writer.print("content b"); + writer.close(); + + Git git = new Git(db); + DirCache dc = git.add().addFilepattern(".").call(); + assertEquals("sub/a.txt", dc.getEntry("sub/a.txt").getPathString()); + assertEquals("sub/b.txt", dc.getEntry("sub/b.txt").getPathString()); + } + private DirCacheEntry addEntryToBuilder(String path, File file, ObjectWriter ow, DirCacheBuilder builder, int stage) throws IOException { |