]> source.dussan.org Git - jgit.git/commitdiff
dfs: only create DfsPackFile if description has PACK 75/101475/2
authorShawn Pearce <spearce@spearce.org>
Wed, 19 Jul 2017 02:30:07 +0000 (19:30 -0700)
committerShawn Pearce <spearce@spearce.org>
Wed, 19 Jul 2017 13:01:43 +0000 (09:01 -0400)
In the future with reftable a DFS implementation may choose to create
a PackDescription that contains only a REFTABLE extension.  Filter
these out by only creating a DfsPackFile if the PackDescription as the
expected PackExt.PACK.

Change-Id: I4c831622378156ae6b68f82c1ee1db5e150893be

org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsObjDatabase.java

index 891d9af2eaa8f8515ce05ba4bfcd9c19a60140b1..76189c1615bdcaae6fafcda44043cd058201205a 100644 (file)
@@ -464,7 +464,7 @@ public abstract class DfsObjDatabase extends ObjectDatabase {
                        DfsPackFile oldPack = forReuse.remove(dsc);
                        if (oldPack != null) {
                                list.add(oldPack);
-                       } else {
+                       } else if (dsc.hasFileExt(PackExt.PACK)) {
                                list.add(new DfsPackFile(cache, dsc));
                                foundNew = true;
                        }
@@ -482,8 +482,7 @@ public abstract class DfsObjDatabase extends ObjectDatabase {
        }
 
        private static Map<DfsPackDescription, DfsPackFile> reuseMap(PackList old) {
-               Map<DfsPackDescription, DfsPackFile> forReuse
-                       = new HashMap<>();
+               Map<DfsPackDescription, DfsPackFile> forReuse = new HashMap<>();
                for (DfsPackFile p : old.packs) {
                        if (p.invalid()) {
                                // The pack instance is corrupted, and cannot be safely used