Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShawn O. Pearce2011-11-16 22:52:31 +0000
committerShawn O. Pearce2011-11-18 23:55:51 +0000
commit4b84186b641ddef39399dfff58bc762090da8fdd (patch)
tree09adf57e0997fb7890bd8f451c41d152749a0cfc
parentce02c82b824fa04cd6ca00affc9c8036e92c500a (diff)
downloadjgit-4b84186b641ddef39399dfff58bc762090da8fdd.tar.gz
jgit-4b84186b641ddef39399dfff58bc762090da8fdd.tar.xz
jgit-4b84186b641ddef39399dfff58bc762090da8fdd.zip
Refactor DfsReader selection of cached packs
Make the code more clear with a simple refactoring of the boolean logic into a method that describes the condition we are looking for on each pack file. A cached pack is possible if there exists a tips collection, and the collection is non-empty. Change-Id: I4ac42b0622b39d159a0f4f223e291c35c71f672c
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/storage/dfs/DfsReader.java9
1 files changed, 6 insertions, 3 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/storage/dfs/DfsReader.java b/org.eclipse.jgit/src/org/eclipse/jgit/storage/dfs/DfsReader.java
index 5d3f9a9354..0772278b1f 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/storage/dfs/DfsReader.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/storage/dfs/DfsReader.java
@@ -554,13 +554,16 @@ final class DfsReader extends ObjectReader implements ObjectReuseAsIs {
List<CachedPack> cached = new ArrayList<CachedPack>(packList.length);
for (DfsPackFile pack : packList) {
DfsPackDescription desc = pack.getPackDescription();
- if (desc.getTips() == null || desc.getTips().isEmpty())
- continue;
- cached.add(new DfsCachedPack(pack));
+ if (canBeCachedPack(desc))
+ cached.add(new DfsCachedPack(pack));
}
return cached;
}
+ private static boolean canBeCachedPack(DfsPackDescription desc) {
+ return desc.getTips() != null && !desc.getTips().isEmpty();
+ }
+
public void copyPackAsIs(PackOutputStream out, CachedPack pack,
boolean validate) throws IOException {
try {

Back to the top