{"thread":{"id":"20663","subject":"[PATCH JGIT] Ensure created test repositories use canonical paths","startedAt":"2009-08-19T13:18:11Z","lastAt":"2009-08-22T10:15:17Z","messageCount":4,"participants":["Jonas Fonseca","Robin Rosenberg"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"121250","messageId":"1250687891-17916-1-git-send-email-fonseca@diku.dk","threadId":"20663","inReplyTo":null,"subject":"[PATCH JGIT] Ensure created test repositories use canonical paths","fromName":"Jonas Fonseca","fromEmail":"fonseca@diku.dk","sentAt":"2009-08-19T13:18:11Z","receivedAt":"2009-08-19T13:18:11Z","isPatch":true,"sender":{"key":"fonseca@diku.dk","avatar":"https://gravatar.com/avatar/f82f3ad698717c51873b020c750a92438c820a24056dc39fe4d07baa10a92264?d=mp&s=160"},"body":"Fixes breakage in the RepositoryCacheTest when running tests using:\n\n\tmvn -f ./jgit-maven/jgit/pom.xml test\n\nwhich in turn will lead to test repositories using paths, such as:\n\n\t/path/to/jgit/./jgit-maven/jgit/trash/trash1250647279819.186/.git\n\nSigned-off-by: Jonas Fonseca <fonseca@diku.dk>\n---\n .../org/spearce/jgit/lib/RepositoryTestCase.java   |    4 ++--\n 1 files changed, 2 insertions(+), 2 deletions(-)\n\ndiff --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\nindex b1adde9..d1aef78 100644\n--- a/org.spearce.jgit.test/tst/org/spearce/jgit/lib/RepositoryTestCase.java\n+++ b/org.spearce.jgit.test/tst/org/spearce/jgit/lib/RepositoryTestCase.java\n@@ -217,7 +217,7 @@ public void setUp() throws Exception {\n \t\tfinal String name = getClass().getName() + \".\" + getName();\n \t\trecursiveDelete(trashParent, true, name, false); // Cleanup old failed stuff\n \t\ttrash = new File(trashParent,\"trash\"+System.currentTimeMillis()+\".\"+(testcount++));\n-\t\ttrash_git = new File(trash, \".git\");\n+\t\ttrash_git = new File(trash, \".git\").getCanonicalFile();\n \t\tif (shutdownhook == null) {\n \t\t\tshutdownhook = new Thread() {\n \t\t\t\t@Override\n@@ -307,7 +307,7 @@ protected Repository createNewEmptyRepo() throws IOException {\n \tprotected Repository createNewEmptyRepo(boolean bare) throws IOException {\n \t\tfinal File newTestRepo = new File(trashParent, \"new\"\n \t\t\t\t+ System.currentTimeMillis() + \".\" + (testcount++)\n-\t\t\t\t+ (bare ? \"\" : \"/\") + \".git\");\n+\t\t\t\t+ (bare ? \"\" : \"/\") + \".git\").getCanonicalFile();\n \t\tassertFalse(newTestRepo.exists());\n \t\tfinal Repository newRepo = new Repository(newTestRepo);\n \t\tnewRepo.create();\n-- \n1.6.4.rc3.195.g2b05f\n"},{"id":"121360","messageId":"200908210035.10825.robin.rosenberg.lists@dewire.com","threadId":"20663","inReplyTo":"1250687891-17916-1-git-send-email-fonseca@diku.dk","subject":"Re: [PATCH JGIT] Ensure created test repositories use canonical paths","fromName":"Robin Rosenberg","fromEmail":"robin.rosenberg.lists@dewire.com","sentAt":"2009-08-20T22:35:10Z","receivedAt":"2009-08-20T22:35:10Z","isPatch":true,"sender":{"key":"robin.rosenberg@dewire.com","avatar":"https://avatars.githubusercontent.com/u/46357?v=4"},"body":"onsdag 19 augusti 2009 15:18:11 skrev Jonas Fonseca <fonseca@diku.dk>:\n> Fixes breakage in the RepositoryCacheTest when running tests using:\n> \n> \tmvn -f ./jgit-maven/jgit/pom.xml test\n> \n> which in turn will lead to test repositories using paths, such as:\n> \n> \t/path/to/jgit/./jgit-maven/jgit/trash/trash1250647279819.186/.git\n> \n> Signed-off-by: Jonas Fonseca <fonseca@diku.dk>\n> ---\n>  .../org/spearce/jgit/lib/RepositoryTestCase.java   |    4 ++--\n>  1 files changed, 2 insertions(+), 2 deletions(-)\n> \n> 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\n> index b1adde9..d1aef78 100644\n> --- a/org.spearce.jgit.test/tst/org/spearce/jgit/lib/RepositoryTestCase.java\n> +++ b/org.spearce.jgit.test/tst/org/spearce/jgit/lib/RepositoryTestCase.java\n> @@ -217,7 +217,7 @@ public void setUp() throws Exception {\n>  \t\tfinal String name = getClass().getName() + \".\" + getName();\n>  \t\trecursiveDelete(trashParent, true, name, false); // Cleanup old failed stuff\n>  \t\ttrash = new File(trashParent,\"trash\"+System.currentTimeMillis()+\".\"+(testcount++));\n> -\t\ttrash_git = new File(trash, \".git\");\n> +\t\ttrash_git = new File(trash, \".git\").getCanonicalFile();\n>  \t\tif (shutdownhook == null) {\n>  \t\t\tshutdownhook = new Thread() {\n>  \t\t\t\t@Override\n> @@ -307,7 +307,7 @@ protected Repository createNewEmptyRepo() throws IOException {\n>  \tprotected Repository createNewEmptyRepo(boolean bare) throws IOException {\n>  \t\tfinal File newTestRepo = new File(trashParent, \"new\"\n>  \t\t\t\t+ System.currentTimeMillis() + \".\" + (testcount++)\n> -\t\t\t\t+ (bare ? \"\" : \"/\") + \".git\");\n> +\t\t\t\t+ (bare ? \"\" : \"/\") + \".git\").getCanonicalFile();\n>  \t\tassertFalse(newTestRepo.exists());\n>  \t\tfinal Repository newRepo = new Repository(newTestRepo);\n>  \t\tnewRepo.create();\n\nWe use getCanonicalFile here and Repository.gitDir  is initialized with getAbsoluteDir. Does this work on all platforms?\nSeems linux normalized things when you do things like, but I'm not sure that happens everywhere.\n\nln -s JGIT x;cd x;pwd;jev 'System.out.println(System.getProperty(\"user.dir\"));'\n/home/me/SW/x\n/home/me/SW/JGIT\n\n\n-- robin\n"},{"id":"121486","messageId":"2c6b72b30908212032t39a4896x3308148c44692a80@mail.gmail.com","threadId":"20663","inReplyTo":"200908210035.10825.robin.rosenberg.lists@dewire.com","subject":"Re: [PATCH JGIT] Ensure created test repositories use canonical paths","fromName":"Jonas Fonseca","fromEmail":"fonseca@diku.dk","sentAt":"2009-08-22T03:32:59Z","receivedAt":"2009-08-22T03:32:59Z","isPatch":true,"sender":{"key":"fonseca@diku.dk","avatar":"https://gravatar.com/avatar/f82f3ad698717c51873b020c750a92438c820a24056dc39fe4d07baa10a92264?d=mp&s=160"},"body":"[With correct CC list. Sorry for the resend Robin]\n\nOn Thu, Aug 20, 2009 at 18:35, Robin\nRosenberg<robin.rosenberg.lists@dewire.com> wrote:\n> onsdag 19 augusti 2009 15:18:11 skrev Jonas Fonseca <fonseca@diku.dk>:\n>> Fixes breakage in the RepositoryCacheTest when running tests using:\n>>\n>>       mvn -f ./jgit-maven/jgit/pom.xml test\n>> [...]\n>> @@ -217,7 +217,7 @@ public void setUp() throws Exception {\n>>               trash = new File(trashParent,\"trash\"+System.currentTimeMillis()+\".\"+(testcount++));\n>> -             trash_git = new File(trash, \".git\");\n>> +             trash_git = new File(trash, \".git\").getCanonicalFile();\n>> @@ -307,7 +307,7 @@ protected Repository createNewEmptyRepo() throws IOException {\n>>       protected Repository createNewEmptyRepo(boolean bare) throws IOException {\n>>               final File newTestRepo = new File(trashParent, \"new\"\n>>                               + System.currentTimeMillis() + \".\" + (testcount++)\n>> -                             + (bare ? \"\" : \"/\") + \".git\");\n>> +                             + (bare ? \"\" : \"/\") + \".git\").getCanonicalFile();\n>\n> We use getCanonicalFile here and Repository.gitDir  is initialized with getAbsoluteDir.\n\nBTW, a simpler fix would be to initialize trashParent to a canonical\npath, which might be less intrusive.\n\n> Does this work on all platforms?\n\nI have only tested on Linux.\n\n> Seems linux normalized things when you do things like, but I'm not sure that happens everywhere.\n\nIf you think it is a problem, let's drop the patch. It just seemed\nlike a simple way to increase robustness.\n\n--\nJonas Fonseca\n"},{"id":"121509","messageId":"200908221215.17681.robin.rosenberg.lists@dewire.com","threadId":"20663","inReplyTo":"2c6b72b30908212032t39a4896x3308148c44692a80@mail.gmail.com","subject":"Re: [PATCH JGIT] Ensure created test repositories use canonical paths","fromName":"Robin Rosenberg","fromEmail":"robin.rosenberg.lists@dewire.com","sentAt":"2009-08-22T10:15:17Z","receivedAt":"2009-08-22T10:15:17Z","isPatch":true,"sender":{"key":"robin.rosenberg@dewire.com","avatar":"https://avatars.githubusercontent.com/u/46357?v=4"},"body":"lördag 22 augusti 2009 05:32:59 skrev Jonas Fonseca <fonseca@diku.dk>:\n> [With correct CC list. Sorry for the resend Robin]\n> \n> On Thu, Aug 20, 2009 at 18:35, Robin\n> Rosenberg<robin.rosenberg.lists@dewire.com> wrote:\n> > onsdag 19 augusti 2009 15:18:11 skrev Jonas Fonseca <fonseca@diku.dk>:\n> >> Fixes breakage in the RepositoryCacheTest when running tests using:\n> >>\n> >>       mvn -f ./jgit-maven/jgit/pom.xml test\n> >> [...]\n> >> @@ -217,7 +217,7 @@ public void setUp() throws Exception {\n> >>               trash = new File(trashParent,\"trash\"+System.currentTimeMillis()+\".\"+(testcount++));\n> >> -             trash_git = new File(trash, \".git\");\n> >> +             trash_git = new File(trash, \".git\").getCanonicalFile();\n> >> @@ -307,7 +307,7 @@ protected Repository createNewEmptyRepo() throws IOException {\n> >>       protected Repository createNewEmptyRepo(boolean bare) throws IOException {\n> >>               final File newTestRepo = new File(trashParent, \"new\"\n> >>                               + System.currentTimeMillis() + \".\" + (testcount++)\n> >> -                             + (bare ? \"\" : \"/\") + \".git\");\n> >> +                             + (bare ? \"\" : \"/\") + \".git\").getCanonicalFile();\n> >\n> > We use getCanonicalFile here and Repository.gitDir  is initialized with getAbsoluteDir.\n> \n> BTW, a simpler fix would be to initialize trashParent to a canonical\n> path, which might be less intrusive.\n> \n> > Does this work on all platforms?\n> \n> I have only tested on Linux.\n> \n> > Seems linux normalized things when you do things like, but I'm not sure that happens everywhere.\n> \n> If you think it is a problem, let's drop the patch. It just seemed\n> like a simple way to increase robustness.\n\nJust a hunch, can't prove it so I'll accept the patch.\n\n-- robin\n"}]}