|
|
@@ -112,7 +112,7 @@ import org.eclipse.jgit.util.FileUtils; |
|
|
|
* @param <R> |
|
|
|
* type of Repository the test data is stored on. |
|
|
|
*/ |
|
|
|
public class TestRepository<R extends Repository> { |
|
|
|
public class TestRepository<R extends Repository> implements AutoCloseable { |
|
|
|
|
|
|
|
/** Constant <code>AUTHOR="J. Author"</code> */ |
|
|
|
public static final String AUTHOR = "J. Author"; |
|
|
@@ -933,6 +933,23 @@ public class TestRepository<R extends Repository> { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Closes the underlying {@link Repository} object and any other internal |
|
|
|
* resources. |
|
|
|
* <p> |
|
|
|
* {@link AutoCloseable} resources that may escape this object, such as |
|
|
|
* those returned by the {@link #git} and {@link #getRevWalk()} methods are |
|
|
|
* not closed. |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public void close() { |
|
|
|
try { |
|
|
|
inserter.close(); |
|
|
|
} finally { |
|
|
|
db.close(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private static void prunePacked(ObjectDirectory odb) throws IOException { |
|
|
|
for (PackFile p : odb.getPacks()) { |
|
|
|
for (MutableEntry e : p) |