diff options
author | Matthias Sohn <matthias.sohn@sap.com> | 2021-03-09 18:00:55 +0100 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2021-03-09 18:00:55 +0100 |
commit | 3aa142e7bf31a3bd662222dac72fe59e9a1c2caf (patch) | |
tree | f3a66b04d83252379c017844fdef5eb1b361caed /org.eclipse.jgit.junit | |
parent | 1172c0b283ad5a8c07d5cfbb798f39e84113b3b2 (diff) | |
parent | 7a3f62818078dea867fe7c5b4e28d215821086b6 (diff) | |
download | jgit-3aa142e7bf31a3bd662222dac72fe59e9a1c2caf.tar.gz jgit-3aa142e7bf31a3bd662222dac72fe59e9a1c2caf.zip |
Merge branch 'master' into stable-5.11
* master:
Manually set status of jmh dependencies
Update DEPENDENCIES report for 5.11.0
Add dependency to dash-licenses
PackFile: Add id + ext based constructors
GC: deleteOrphans: Use PackFile
PackExt: Convert to Enum
Restore preserved packs during missing object seeks
Pack: Replace extensions bitset with bitmapIdx PackFile
PackDirectory: Use PackFile to ensure we find preserved packs
GC: Use PackFile to de-dup logic
Create a PackFile class for Pack filenames
Change-Id: I1d56517cb6a95e10aed22cdb9e5f3e504872d110
Diffstat (limited to 'org.eclipse.jgit.junit')
-rw-r--r-- | org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/TestRepository.java | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/TestRepository.java b/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/TestRepository.java index e3eb2c5367..0232156a49 100644 --- a/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/TestRepository.java +++ b/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/TestRepository.java @@ -44,7 +44,9 @@ import org.eclipse.jgit.internal.storage.file.FileRepository; import org.eclipse.jgit.internal.storage.file.LockFile; import org.eclipse.jgit.internal.storage.file.ObjectDirectory; import org.eclipse.jgit.internal.storage.file.Pack; +import org.eclipse.jgit.internal.storage.file.PackFile; import org.eclipse.jgit.internal.storage.file.PackIndex.MutableEntry; +import org.eclipse.jgit.internal.storage.pack.PackExt; import org.eclipse.jgit.internal.storage.pack.PackWriter; import org.eclipse.jgit.lib.AnyObjectId; import org.eclipse.jgit.lib.Constants; @@ -906,23 +908,22 @@ public class TestRepository<R extends Repository> implements AutoCloseable { ObjectDirectory odb = (ObjectDirectory) db.getObjectDatabase(); NullProgressMonitor m = NullProgressMonitor.INSTANCE; - final File pack, idx; + final PackFile pack, idx; try (PackWriter pw = new PackWriter(db)) { Set<ObjectId> all = new HashSet<>(); for (Ref r : db.getRefDatabase().getRefs()) all.add(r.getObjectId()); pw.preparePack(m, all, PackWriter.NONE); - final ObjectId name = pw.computeName(); - - pack = nameFor(odb, name, ".pack"); + pack = new PackFile(odb.getPackDirectory(), pw.computeName(), + PackExt.PACK); try (OutputStream out = new BufferedOutputStream(new FileOutputStream(pack))) { pw.writePack(m, m, out); } pack.setReadOnly(); - idx = nameFor(odb, name, ".idx"); + idx = pack.create(PackExt.INDEX); try (OutputStream out = new BufferedOutputStream(new FileOutputStream(idx))) { pw.writeIndex(out); @@ -960,11 +961,6 @@ public class TestRepository<R extends Repository> implements AutoCloseable { } } - private static File nameFor(ObjectDirectory odb, ObjectId name, String t) { - File packdir = odb.getPackDirectory(); - return new File(packdir, "pack-" + name.name() + t); - } - private void writeFile(File p, byte[] bin) throws IOException, ObjectWritingException { final LockFile lck = new LockFile(p); |