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

[PATCH JGIT] Ensure created test repositories use canonical paths

From
Jonas Fonseca <fonseca@diku.dk>
Date
Aug 19, 2009, 13:18 UTC
Message-ID
<1250687891-17916-1-git-send-email-fonseca@diku.dk>
Fixes breakage in the RepositoryCacheTest when running tests using:
	mvn -f ./jgit-maven/jgit/pom.xml test
which in turn will lead to test repositories using paths, such as:
	/path/to/jgit/./jgit-maven/jgit/trash/trash1250647279819.186/.git
Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
---
 .../org/spearce/jgit/lib/RepositoryTestCase.java   |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/org.spearce.jgit.test/tst/org/spearce/jgit/lib/RepositoryTestCase.java b/org.spearce.jgit.test/tst/org/spearce/jgit/lib/RepositoryTestCase.java
index b1adde9..d1aef78 100644
--- a/org.spearce.jgit.test/tst/org/spearce/jgit/lib/RepositoryTestCase.java
+++ b/org.spearce.jgit.test/tst/org/spearce/jgit/lib/RepositoryTestCase.java
@@ -217,7 +217,7 @@ public void setUp() throws Exception {
 		final String name = getClass().getName() + "." + getName();
 		recursiveDelete(trashParent, true, name, false); // Cleanup old failed stuff
 		trash = new File(trashParent,"trash"+System.currentTimeMillis()+"."+(testcount++));
-		trash_git = new File(trash, ".git");
+		trash_git = new File(trash, ".git").getCanonicalFile();
 		if (shutdownhook == null) {
 			shutdownhook = new Thread() {
 				@Override
@@ -307,7 +307,7 @@ protected Repository createNewEmptyRepo() throws IOException {
 	protected Repository createNewEmptyRepo(boolean bare) throws IOException {
 		final File newTestRepo = new File(trashParent, "new"
 				+ System.currentTimeMillis() + "." + (testcount++)
-				+ (bare ? "" : "/") + ".git");
+				+ (bare ? "" : "/") + ".git").getCanonicalFile();
 		assertFalse(newTestRepo.exists());
 		final Repository newRepo = new Repository(newTestRepo);
 		newRepo.create();
-- 
1.6.4.rc3.195.g2b05f
Next: Robin Rosenberg
Message 1 of 4 in “Ensure created test repositories use canonical paths”
  1. Ensure created test repositories use canonical pathsJonas Fonseca, Aug 19, 2009
  2. Robin RosenbergAug 20, 2009
  3. Jonas FonsecaAug 22, 2009
  4. Robin RosenbergAug 22, 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.