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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



onsdag 19 augusti 2009 15:18:11 skrev Jonas Fonseca <fonseca@xxxxxxx>:
> 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@xxxxxxx>
> ---
>  .../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();

We use getCanonicalFile here and Repository.gitDir  is initialized with getAbsoluteDir. Does this work on all platforms?
Seems linux normalized things when you do things like, but I'm not sure that happens everywhere.

ln -s JGIT x;cd x;pwd;jev 'System.out.println(System.getProperty("user.dir"));'
/home/me/SW/x
/home/me/SW/JGIT


-- robin
--
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

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]