refactored; disabled repo caching for now

This commit is contained in:
2020-12-01 16:09:35 -05:00
parent 13e190fd5c
commit 388d490122
5 changed files with 179 additions and 129 deletions

View File

@@ -3,12 +3,14 @@ package me.brianlong.git;
import java.io.File;
import java.io.IOException;
import java.util.List;
import java.util.UUID;
import org.eclipse.jgit.api.CloneCommand;
import org.eclipse.jgit.api.Git;
import org.eclipse.jgit.api.ListBranchCommand.ListMode;
import org.eclipse.jgit.api.errors.GitAPIException;
import org.eclipse.jgit.lib.Ref;
import org.eclipse.jgit.util.FileUtils;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.BeforeClass;
@@ -23,8 +25,7 @@ public class CommandUnitTest {
@BeforeClass
public static void init() throws GitAPIException, IOException {
tmpdir = new File(System.getProperty("java.io.tmpdir"), "git.tmp");
tmpdir.mkdirs();
tmpdir = new File(System.getProperty("java.io.tmpdir"), "git-" + UUID.randomUUID().toString() + ".tmp");
git = new CloneCommand()
.setURI("git@github.com:bmlong137/env-docker-adbp.git")
@@ -34,11 +35,10 @@ public class CommandUnitTest {
}
@AfterClass
public static void cleanup() {
git.getRepository().close();
public static void cleanup() throws IOException {
git.close();
tmpdir.deleteOnExit();
FileUtils.delete(tmpdir, FileUtils.RECURSIVE);
}
@Test