git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH JGit 12/19] moved info/packs into a constant

From
mr.gaffo@gmail.com <mr.gaffo@gmail.com>
Date
Sep 13, 2009, 18:44 UTC
Message-ID
<1252867475-858-13-git-send-email-mr.gaffo@gmail.com>
In-Reply-To
<1252867475-858-12-git-send-email-mr.gaffo@gmail.com>
From: mike.gaffney <mike.gaffney@asolutions.com>
---
 .../org/spearce/jgit/lib/ObjectDirectoryTest.java  |    5 ++---
 .../src/org/spearce/jgit/lib/Constants.java        |    3 +++
 .../src/org/spearce/jgit/lib/ObjectDirectory.java  |    2 +-
 3 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/org.spearce.jgit.test/tst/org/spearce/jgit/lib/ObjectDirectoryTest.java b/org.spearce.jgit.test/tst/org/spearce/jgit/lib/ObjectDirectoryTest.java
index 4ac62fa..b27f2f8 100644
--- a/org.spearce.jgit.test/tst/org/spearce/jgit/lib/ObjectDirectoryTest.java
+++ b/org.spearce.jgit.test/tst/org/spearce/jgit/lib/ObjectDirectoryTest.java
@@ -79,7 +79,7 @@ public void testListLocalPacksWhenThereIsAPack() throws Exception {
 		assertEquals(TEST_PACK.getName(), localPacks.get(0).getPackFile().getName());
 	}
 	
-	public void testUpdateInfoCacheCreatesPacksFile() throws Exception {
+	public void testUpdateInfoCacheCreatesPacksAndRefsFile() throws Exception {
 		createSamplePacksDir();
 
 		ObjectDirectory od = new ObjectDirectory(testDir);
@@ -87,7 +87,7 @@ public void testUpdateInfoCacheCreatesPacksFile() throws Exception {
 		od.updateInfoCache();
 		
 		String expectedContents = new PacksFileContentsCreator(od.listLocalPacks()).toString();
-		File packsFile = new File(od.getDirectory(), "info/packs");
+		File packsFile = new File(od.getDirectory(), Constants.CACHED_PACKS_FILE);
 
 		assertTrue(packsFile.exists());
 		assertEquals(expectedContents, JGitTestUtil.readFileAsString(packsFile));
@@ -103,7 +103,6 @@ public boolean deleteDir(File dir) {
                 }
             }
         }
-    
         // The directory is now empty so delete it
         return dir.delete();
     }
diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/Constants.java b/org.spearce.jgit/src/org/spearce/jgit/lib/Constants.java
index 9afea67..2d78dda 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/lib/Constants.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/lib/Constants.java
@@ -224,6 +224,9 @@
 
 	/** Info refs folder */
 	public static final String INFO_REFS = "info/refs";
+	
+	/** cached packs file */
+	public static final String CACHED_PACKS_FILE = "info/packs"; 
 
 	/** Packed refs file */
 	public static final String PACKED_REFS = "packed-refs";
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 71536c9..f4251c1 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 UpdateDirectoryBasedPacksInfoCache(this.listLocalPacks(), new File(this.infoDirectory, "packs")).execute();
+		new UpdateDirectoryBasedPacksInfoCache(this.listLocalPacks(), new File(this.getDirectory(), Constants.CACHED_PACKS_FILE)).execute();
 	}
 }
-- 
1.6.4.2
Previous: mr.gaffo@gmail.comNext: mr.gaffo@gmail.com
Message 13 of 25 in “Adding update-server-info functionality”
  1. Adding update-server-info functionalitymr.gaffo@gmail.com, Sep 13, 2009
  2. 01/19 adding tests for ObjectDirectorymr.gaffo@gmail.com, Sep 13, 2009
  3. 02/19 Create abstract method on ObjectDatabase for accessing the list of local pack files.mr.gaffo@gmail.com, Sep 13, 2009
  4. 03/19 Add abstract method for updating the object db's info cache Implemented passthrough on Alternate for the update of infocachemr.gaffo@gmail.com, Sep 13, 2009
  5. 04/19 added utility that generates the contents of the objects/info/packs file as a string from a list of PackFilesmr.gaffo@gmail.com, Sep 13, 2009
  6. 05/19 Made tests for listLocalPacks function on ObjectDirectory and made them passmr.gaffo@gmail.com, Sep 13, 2009
  7. 06/19 added utility for reading the contents of a file as a stringmr.gaffo@gmail.com, Sep 13, 2009
  8. 07/19 implemented the packs file update functionalitymr.gaffo@gmail.com, Sep 13, 2009
  9. 08/19 changed signature to allow a IOExceptionmr.gaffo@gmail.com, Sep 13, 2009
  10. 09/19 Didn't like the old name, this is more specific to it just updating the packs info cachemr.gaffo@gmail.com, Sep 13, 2009
  11. 10/19 moved test up to a higher level to test actual functionalitymr.gaffo@gmail.com, Sep 13, 2009
  12. 11/19 removed unused importmr.gaffo@gmail.com, Sep 13, 2009
  13. 12/19 moved info/packs into a constantmr.gaffo@gmail.com, Sep 13, 2009
  14. 13/19 made the call update the object database's info cachemr.gaffo@gmail.com, Sep 13, 2009
  15. 14/19 pulled out some helper functions that will be useful for other testsmr.gaffo@gmail.com, Sep 13, 2009
  16. 15/19 Adding in a InfoDatabase like ObjectDatabase and and implementation based upon a directory.mr.gaffo@gmail.com, Sep 13, 2009
  17. 16/19 added tests for the file based info cache update and made passmr.gaffo@gmail.com, Sep 13, 2009
  18. 17/19 added call to update the info refs filemr.gaffo@gmail.com, Sep 13, 2009
  19. 18/19 Added Copyright Noticesmr.gaffo@gmail.com, Sep 13, 2009
  20. 19/19 changed \r to \n per compliance with real gitmr.gaffo@gmail.com, Sep 13, 2009
  21. Robin RosenbergSep 15, 2009
  22. Robin RosenbergSep 15, 2009
  23. Robin RosenbergSep 15, 2009
  24. Robin RosenbergSep 15, 2009
  25. Robin RosenbergSep 15, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.