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

Re: [PATCH JGIT] Ensure created test repositories use canonical paths

From
Robin Rosenberg <robin.rosenberg.lists@dewire.com>
Date
Aug 22, 2009, 10:15 UTC
Message-ID
<200908221215.17681.robin.rosenberg.lists@dewire.com>
In-Reply-To
<2c6b72b30908212032t39a4896x3308148c44692a80@mail.gmail.com>
lördag 22 augusti 2009 05:32:59 skrev Jonas Fonseca <fonseca@diku.dk>:
Show 33 quoted lines
> [With correct CC list. Sorry for the resend Robin]
> 
> On Thu, Aug 20, 2009 at 18:35, Robin
> Rosenberg<robin.rosenberg.lists@dewire.com> wrote:
> > onsdag 19 augusti 2009 15:18:11 skrev Jonas Fonseca <fonseca@diku.dk>:
> >> Fixes breakage in the RepositoryCacheTest when running tests using:
> >>
> >>       mvn -f ./jgit-maven/jgit/pom.xml test
> >> [...]
> >> @@ -217,7 +217,7 @@ public void setUp() throws Exception {
> >>               trash = new File(trashParent,"trash"+System.currentTimeMillis()+"."+(testcount++));
> >> -             trash_git = new File(trash, ".git");
> >> +             trash_git = new File(trash, ".git").getCanonicalFile();
> >> @@ -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();
> >
> > We use getCanonicalFile here and Repository.gitDir  is initialized with getAbsoluteDir.
> 
> BTW, a simpler fix would be to initialize trashParent to a canonical
> path, which might be less intrusive.
> 
> > Does this work on all platforms?
> 
> I have only tested on Linux.
> 
> > Seems linux normalized things when you do things like, but I'm not sure that happens everywhere.
> 
> If you think it is a problem, let's drop the patch. It just seemed
> like a simple way to increase robustness.
Just a hunch, can't prove it so I'll accept the patch.
-- robin
Previous: Jonas Fonseca
Message 4 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.