From: mike.gaffney <mike.gaffney@xxxxxxxxxxxxxx> --- .../UpdateDirectoryBasedPacksInfoCacheTest.java | 30 ++++++++++++++++++++ .../jgit/lib/UpdateDirectoryInfoCacheTest.java | 30 -------------------- .../src/org/spearce/jgit/lib/ObjectDirectory.java | 2 +- .../lib/UpdateDirectoryBasedPacksInfoCache.java | 27 ++++++++++++++++++ .../spearce/jgit/lib/UpdateDirectoryInfoCache.java | 27 ------------------ 5 files changed, 58 insertions(+), 58 deletions(-) create mode 100644 org.spearce.jgit.test/tst/org/spearce/jgit/lib/UpdateDirectoryBasedPacksInfoCacheTest.java delete mode 100644 org.spearce.jgit.test/tst/org/spearce/jgit/lib/UpdateDirectoryInfoCacheTest.java create mode 100644 org.spearce.jgit/src/org/spearce/jgit/lib/UpdateDirectoryBasedPacksInfoCache.java delete mode 100644 org.spearce.jgit/src/org/spearce/jgit/lib/UpdateDirectoryInfoCache.java diff --git a/org.spearce.jgit.test/tst/org/spearce/jgit/lib/UpdateDirectoryBasedPacksInfoCacheTest.java b/org.spearce.jgit.test/tst/org/spearce/jgit/lib/UpdateDirectoryBasedPacksInfoCacheTest.java new file mode 100644 index 0000000..f5163e4 --- /dev/null +++ b/org.spearce.jgit.test/tst/org/spearce/jgit/lib/UpdateDirectoryBasedPacksInfoCacheTest.java @@ -0,0 +1,30 @@ +package org.spearce.jgit.lib; + +import java.io.File; +import java.util.ArrayList; +import java.util.List; + +import junit.framework.TestCase; + +import org.spearce.jgit.util.JGitTestUtil; + +public class UpdateDirectoryBasedPacksInfoCacheTest extends TestCase { + private static final String PACK_NAME = "pack-34be9032ac282b11fa9babdc2b2a93ca996c9c2f"; + private static final File TEST_PACK = JGitTestUtil.getTestResourceFile(PACK_NAME + ".pack"); + private static final File TEST_IDX = JGitTestUtil.getTestResourceFile(PACK_NAME + ".idx"); + + public void testCreatesTheFileAndPutsTheContentsIn() throws Exception { + List<PackFile> packs = new ArrayList<PackFile>(); + packs.add(new PackFile(TEST_IDX, TEST_PACK)); + + File packsFile = File.createTempFile(UpdateDirectoryBasedPacksInfoCacheTest.class.getSimpleName(), "tstdata"); + packsFile.deleteOnExit(); + + String expectedContents = new PacksFileContentsCreator(packs).toString(); + + new UpdateDirectoryBasedPacksInfoCache(packs, packsFile).execute(); + + assertEquals(expectedContents, JGitTestUtil.readFileAsString(packsFile)); + } + +} diff --git a/org.spearce.jgit.test/tst/org/spearce/jgit/lib/UpdateDirectoryInfoCacheTest.java b/org.spearce.jgit.test/tst/org/spearce/jgit/lib/UpdateDirectoryInfoCacheTest.java deleted file mode 100644 index 25b78c5..0000000 --- a/org.spearce.jgit.test/tst/org/spearce/jgit/lib/UpdateDirectoryInfoCacheTest.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.spearce.jgit.lib; - -import java.io.File; -import java.util.ArrayList; -import java.util.List; - -import junit.framework.TestCase; - -import org.spearce.jgit.util.JGitTestUtil; - -public class UpdateDirectoryInfoCacheTest extends TestCase { - private static final String PACK_NAME = "pack-34be9032ac282b11fa9babdc2b2a93ca996c9c2f"; - private static final File TEST_PACK = JGitTestUtil.getTestResourceFile(PACK_NAME + ".pack"); - private static final File TEST_IDX = JGitTestUtil.getTestResourceFile(PACK_NAME + ".idx"); - - public void testCreatesTheFileAndPutsTheContentsIn() throws Exception { - List<PackFile> packs = new ArrayList<PackFile>(); - packs.add(new PackFile(TEST_IDX, TEST_PACK)); - - File packsFile = File.createTempFile(UpdateDirectoryInfoCacheTest.class.getSimpleName(), "tstdata"); - packsFile.deleteOnExit(); - - String expectedContents = new PacksFileContentsCreator(packs).toString(); - - new UpdateDirectoryInfoCache(packs, packsFile).execute(); - - assertEquals(expectedContents, JGitTestUtil.readFileAsString(packsFile)); - } - -} diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/ObjectDirectory.java b/org.spearce.jgit/src/org/spearce/jgit/lib/ObjectDirectory.java index 95618b9..71536c9 100644 --- a/org.spearce.jgit/src/org/spearce/jgit/lib/ObjectDirectory.java +++ b/org.spearce.jgit/src/org/spearce/jgit/lib/ObjectDirectory.java @@ -517,6 +517,6 @@ boolean tryAgain(final long currLastModified) { @Override public void updateInfoCache() throws IOException { - new UpdateDirectoryInfoCache(this.listLocalPacks(), new File(this.infoDirectory, "packs")).execute(); + new UpdateDirectoryBasedPacksInfoCache(this.listLocalPacks(), new File(this.infoDirectory, "packs")).execute(); } } diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/UpdateDirectoryBasedPacksInfoCache.java b/org.spearce.jgit/src/org/spearce/jgit/lib/UpdateDirectoryBasedPacksInfoCache.java new file mode 100644 index 0000000..3e24cd2 --- /dev/null +++ b/org.spearce.jgit/src/org/spearce/jgit/lib/UpdateDirectoryBasedPacksInfoCache.java @@ -0,0 +1,27 @@ +package org.spearce.jgit.lib; + +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.util.List; + +public class UpdateDirectoryBasedPacksInfoCache { + + private List<PackFile> packsList; + private File infoPacksFile; + + public UpdateDirectoryBasedPacksInfoCache(List<PackFile> packsList, + File infoPacksFile) { + this.packsList = packsList; + this.infoPacksFile = infoPacksFile; + } + + public void execute() throws IOException { + String packsContents = new PacksFileContentsCreator(packsList).toString(); + FileOutputStream fos = new FileOutputStream(infoPacksFile); + fos.write(packsContents.getBytes()); + fos.close(); + } + +} diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/UpdateDirectoryInfoCache.java b/org.spearce.jgit/src/org/spearce/jgit/lib/UpdateDirectoryInfoCache.java deleted file mode 100644 index 72a315a..0000000 --- a/org.spearce.jgit/src/org/spearce/jgit/lib/UpdateDirectoryInfoCache.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.spearce.jgit.lib; - -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.util.List; - -public class UpdateDirectoryInfoCache { - - private List<PackFile> packsList; - private File infoPacksFile; - - public UpdateDirectoryInfoCache(List<PackFile> packsList, - File infoPacksFile) { - this.packsList = packsList; - this.infoPacksFile = infoPacksFile; - } - - public void execute() throws IOException { - String packsContents = new PacksFileContentsCreator(packsList).toString(); - FileOutputStream fos = new FileOutputStream(infoPacksFile); - fos.write(packsContents.getBytes()); - fos.close(); - } - -} -- 1.6.4.2 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html