summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit
diff options
context:
space:
mode:
authorZhen Chen <czhen@google.com>2017-02-13 12:36:25 -0800
committerZhen Chen <czhen@google.com>2017-02-13 20:54:35 -0400
commitff852dad518b99edc31e88cbe8c8f45ba207c6a5 (patch)
tree4238bc27e70869ef8c9a55db3d1325f43e27387e /org.eclipse.jgit
parent8dd5b644dc8811ae3ba39fcfbb8babca31a1abe1 (diff)
downloadjgit-ff852dad518b99edc31e88cbe8c8f45ba207c6a5.tar.gz
jgit-ff852dad518b99edc31e88cbe8c8f45ba207c6a5.zip
Skip first pack if avoid garbage is set and it is a garbage pack
At beginning of the OBJECT_SCAN loop, it will first check if the object exists in the last pack, however, it forgot to avoid garbage pack for the first iteration. Change-Id: I8a99c0f439218d19c49cd4dae891b8cc4a57099d Signed-off-by: Zhen Chen <czhen@google.com>
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsReader.java18
1 files changed, 10 insertions, 8 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsReader.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsReader.java
index 8d934879e1..3593c6101c 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsReader.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsReader.java
@@ -332,15 +332,17 @@ public final class DfsReader extends ObjectReader implements ObjectReuseAsIs {
OBJECT_SCAN: for (Iterator<T> it = pending.iterator(); it.hasNext();) {
T t = it.next();
- try {
- long p = lastPack.findOffset(this, t);
- if (0 < p) {
- r.add(new FoundObject<T>(t, lastIdx, lastPack, p));
- it.remove();
- continue;
+ if (!skipGarbagePack(lastPack)) {
+ try {
+ long p = lastPack.findOffset(this, t);
+ if (0 < p) {
+ r.add(new FoundObject<T>(t, lastIdx, lastPack, p));
+ it.remove();
+ continue;
+ }
+ } catch (IOException e) {
+ // Fall though and try to examine other packs.
}
- } catch (IOException e) {
- // Fall though and try to examine other packs.
}
for (int i = 0; i < packs.length; i++) {