diff options
author | Shawn O. Pearce <spearce@spearce.org> | 2011-08-13 17:33:18 -0400 |
---|---|---|
committer | Code Review <codereview-daemon@eclipse.org> | 2011-08-13 17:33:18 -0400 |
commit | 82e735c3aa03e90f5944f6d5a9cf0d20320f3b93 (patch) | |
tree | f8965f99d48765b1ce72f69f13eadc2cce3e2538 | |
parent | a5f5b20dff63f30aba69437f4c2386d96072daff (diff) | |
parent | 99e6cfb131bb407247acbc8c0a73e7c7cf37ebc2 (diff) | |
download | jgit-82e735c3aa03e90f5944f6d5a9cf0d20320f3b93.tar.gz jgit-82e735c3aa03e90f5944f6d5a9cf0d20320f3b93.zip |
Merge "PackWriter: Only search for base objects on thin packs"
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java | 35 |
1 files changed, 22 insertions, 13 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java b/org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java index 3007b809c2..2153ad5d3f 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java @@ -1437,20 +1437,29 @@ public class PackWriter { } commits = null; - BaseSearch bases = new BaseSearch(countingMonitor, baseTrees, // - objectsMap, edgeObjects, reader); - RevObject o; - while ((o = walker.nextObject()) != null) { - if (o.has(RevFlag.UNINTERESTING)) - continue; - - int pathHash = walker.getPathHashCode(); - byte[] pathBuf = walker.getPathBuffer(); - int pathLen = walker.getPathLength(); + if (thin && !baseTrees.isEmpty()) { + BaseSearch bases = new BaseSearch(countingMonitor, baseTrees, // + objectsMap, edgeObjects, reader); + RevObject o; + while ((o = walker.nextObject()) != null) { + if (o.has(RevFlag.UNINTERESTING)) + continue; - bases.addBase(o.getType(), pathBuf, pathLen, pathHash); - addObject(o, pathHash); - countingMonitor.update(1); + int pathHash = walker.getPathHashCode(); + byte[] pathBuf = walker.getPathBuffer(); + int pathLen = walker.getPathLength(); + bases.addBase(o.getType(), pathBuf, pathLen, pathHash); + addObject(o, pathHash); + countingMonitor.update(1); + } + } else { + RevObject o; + while ((o = walker.nextObject()) != null) { + if (o.has(RevFlag.UNINTERESTING)) + continue; + addObject(o, walker.getPathHashCode()); + countingMonitor.update(1); + } } for (CachedPack pack : cachedPacks) |