diff options
author | Robin Rosenberg <robin.rosenberg@dewire.com> | 2011-01-29 17:52:12 -0500 |
---|---|---|
committer | Code Review <codereview-daemon@eclipse.org> | 2011-01-29 17:52:12 -0500 |
commit | 9ffcf2a8b3cb49c445fabd011b26a36e622a033c (patch) | |
tree | 930526e957ff205047d51d9f688f7891fb0e96e4 | |
parent | 9fbda2239202ca9d3a20c84d7326f47c667aa920 (diff) | |
parent | a6e3f5306966e4befde17358c79941bc5849f826 (diff) | |
download | jgit-9ffcf2a8b3cb49c445fabd011b26a36e622a033c.tar.gz jgit-9ffcf2a8b3cb49c445fabd011b26a36e622a033c.zip |
Merge changes I3a74cc84,I219f864f
* changes:
[findbugs] Do not ignore exceptional return value of createNewFile()
Do not create files to be updated before checkout of DirCache entry
3 files changed, 6 insertions, 10 deletions
diff --git a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/FileResolverTest.java b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/FileResolverTest.java index a7e31a5d4c..7009cf98a3 100644 --- a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/FileResolverTest.java +++ b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/FileResolverTest.java @@ -47,7 +47,6 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import java.io.File; @@ -58,6 +57,7 @@ import org.eclipse.jgit.http.server.resolver.FileResolver; import org.eclipse.jgit.http.server.resolver.ServiceNotEnabledException; import org.eclipse.jgit.junit.LocalDiskRepositoryTestCase; import org.eclipse.jgit.lib.Repository; +import org.eclipse.jgit.util.FileUtils; import org.junit.Test; public class FileResolverTest extends LocalDiskRepositoryTestCase { @@ -116,8 +116,7 @@ public class FileResolverTest extends LocalDiskRepositoryTestCase { fail("did not honor export-all flag"); } - export.createNewFile(); - assertTrue("has git-daemon-export-ok", export.exists()); + FileUtils.createNewFile(export); resolver = new FileResolver(base, false /* require flag */); try { resolver.open(null, name).close(); diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/filter/IndexDiffFilterTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/filter/IndexDiffFilterTest.java index 542e169d73..4c103c83da 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/filter/IndexDiffFilterTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/filter/IndexDiffFilterTest.java @@ -56,6 +56,7 @@ import org.eclipse.jgit.lib.RepositoryTestCase; import org.eclipse.jgit.revwalk.RevCommit; import org.eclipse.jgit.treewalk.FileTreeIterator; import org.eclipse.jgit.treewalk.TreeWalk; +import org.eclipse.jgit.util.FileUtils; import org.junit.Before; import org.junit.Test; @@ -537,8 +538,7 @@ public class IndexDiffFilterTest extends RepositoryTestCase { private void createEmptyFolder() throws Exception { File path = new File(db.getWorkTree(), FOLDER); - path.mkdir(); - assertTrue(path.isDirectory()); + FileUtils.mkdir(path); } private RevCommit createEmptyFolderAndCommit() throws Exception { @@ -548,14 +548,12 @@ public class IndexDiffFilterTest extends RepositoryTestCase { private void createEmptyFolderUntracked() throws Exception { File path = new File(db.getWorkTree(), UNTRACKED_FOLDER); - path.mkdir(); - assertTrue(path.isDirectory()); + FileUtils.mkdir(path); } private void createEmptyFolderIgnored() throws Exception { File path = new File(db.getWorkTree(), IGNORED_FOLDER); - path.mkdir(); - assertTrue(path.isDirectory()); + FileUtils.mkdir(path); writeTrashFile(GITIGNORE, GITIGNORE + "\n" + IGNORED_FOLDER + "/"); } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java b/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java index dbd05117fd..8df583cc6a 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java @@ -422,7 +422,6 @@ public class DirCacheCheckout { if (!file.getParentFile().mkdirs()) { // ignore } - file.createNewFile(); DirCacheEntry entry = dc.getEntry(path); checkoutEntry(repo, file, entry); } |